Queried result from cotroller to PartialView into Listbox
-
Hi, I am new to ASP.NET MVC. I would like to get some help on getting custom data from controller to view. 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 [CODE]return PartialView(rds.ToList())[/CODE] 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. Thanks
-
Hi, I am new to ASP.NET MVC. I would like to get some help on getting custom data from controller to view. 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 [CODE]return PartialView(rds.ToList())[/CODE] 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. Thanks
Just give your partial view a @model of whatever type "tds.ToList()" is
@model List
or whatever it happens to be, then in your view
foreach (var item in Model)
{@item.SomeProperty
}