In my application, I have one ActionResult method in surface controller. From that it is passing list through ViewData. In view page, it is showing data in Quick Watch properly.
But now I am not able to convert it to list or any other type, so that using for loop I can show it on page.
Please suggest me how to handle ViewData in partial view? Please guide me.
Or guide me for handling list from surface controller.
ViewData to list in view page.
Hi,
In my application, I have one ActionResult method in surface controller. From that it is passing list through ViewData. In view page, it is showing data in Quick Watch properly.
But now I am not able to convert it to list or any other type, so that using for loop I can show it on page.
Please suggest me how to handle ViewData in partial view? Please guide me.
Or guide me for handling list from surface controller.
Thanks, Dipa
Hi,
A better aproach would be to create a new
ViewModel
which is just a class that contains your list property and pass this into yourPartialView
.Code not tested
Create a new class in your
Models
folder:In your surface controller:
And then in your partial view:
/Michael
is working on a reply...