I want to display multiple webgrids in one view each showing a different recordset from a stored procedure. So I created a view and then a partial view. The view has multiple lines of code that looks like:
@{Html.RenderAction("StoreStandingsList", new { FormCollection = ViewData["FormData"], GroupName = "Wash", Type = "Ticket", Header = "Net Ticket", HeaderClass = "BlueHeader" });}
It calls to a method named StoreStandingsList in the Controller. That method loads some ViewData values, most importantly the Grid. I have to apply a little more processing to the output of the grid's GetHtml method and I prefer to do that in the Controller
so I just return the output of the GetHtml method to the Partial View via the ViewData["Grid"] code snippet above. If you want to suggest a completely different way of approaching this please do, but I don't know if I can understand anything very complicated
because this is my first real MVC and Razor project.
DallasSteve
Member
222 Points
338 Posts
Re: How To Render A Partial View In Razor
May 01, 2012 05:54 PM|LINK
CodeHobo
It's pretty complicated. Here's the short answer:
Here's the long answer:
I want to display multiple webgrids in one view each showing a different recordset from a stored procedure. So I created a view and then a partial view. The view has multiple lines of code that looks like:
@{Html.RenderAction("StoreStandingsList", new { FormCollection = ViewData["FormData"], GroupName = "Wash", Type = "Ticket", Header = "Net Ticket", HeaderClass = "BlueHeader" });}It calls to a method named StoreStandingsList in the Controller. That method loads some ViewData values, most importantly the Grid. I have to apply a little more processing to the output of the grid's GetHtml method and I prefer to do that in the Controller so I just return the output of the GetHtml method to the Partial View via the ViewData["Grid"] code snippet above. If you want to suggest a completely different way of approaching this please do, but I don't know if I can understand anything very complicated because this is my first real MVC and Razor project.
www.SteveGaines.us