I have written an Action method for an ASP.NET MVC controller, which is being used to provide a model to a usercontrol.
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 'futures' Microsoft.Web.Mvc
dll and rendering the control in my main view like this :
<% Html.RenderAction<ProductsController>(x => x.ProductSummary()); %>
What I have here appears to work just fine, but i attempted to google new PartialResult()
to see if what I was doing was following the correct patterns.
Currently this search only comes up with 4 results!
So I figured I'm doing somethin wrong here in my controller. Whats the correct way to create an action method that returns a partial view? And what (if anything) is wrong or bad about what I'm doing.