I wrote an Action method for the ASP.NET MVC controller, which is used to provide the model with user control.
public class ProductsController: Controller {
public PartialViewResult ProductSummary() { ViewData.Model = new ProductSummaryModel("42"); // dummy data for now return new PartialViewResult() { ViewData = ViewData }; } }
I am using the Microsoft.Web.Mvc dll 'futures' and the visualization of the control in my main view as follows:
<% Html.RenderAction<ProductsController>(x => x.ProductSummary()); %>
What I have here seems to work very well, but I tried to do google new PartialResult() to find out if I should have the right templates.
Currently this search contains only 4 results!
So, I thought that I was doing something wrong in my controller. What is the correct way to create an action method that returns a partial view? And what (if anything) is wrong or bad in what I do.
source share