Queried result to Listbox in Partial View

capri

Active member
Joined
Jun 16, 2015
Messages
42
Programming Experience
5-10
[FONT=&quot]Hi,[/FONT]
[FONT=&quot][/FONT]
[FONT=&quot]I am new to ASP.NET MVC. I would like to get some help on getting custom data from controller to view.[/FONT]
[FONT=&quot][/FONT]
[FONT=&quot]I have queried and concatenated the result of a table from model based on a criteria. I want this to be viewed as a partial view in the Index page. For this, I pass the queried result as follows[/FONT]
[FONT=&quot]
C#:
return PartialView(rds.ToList())
[/FONT]

[FONT=&quot][/FONT]
[FONT=&quot]The purpose is to display a listview of these items in the Index view as partial. I don't know how to grab this data from the partial view. Please help.[/FONT]
[FONT=&quot][/FONT]
[FONT=&quot]Thanks[/FONT]
 
Whatever you pass to that PartialView method is the model for your partial view, therefore you access it via the Model property in that view. Your model would likely be type IEnumerable<T> where T is whatever the item type is in `rds`.
 

Latest posts

Back
Top Bottom