Just a little reminder that there is a separate project, called ASP.NET MVC Futures, that you can download from CodePlex that has a lot of wonderful little goodies for MVC Web Applications. Essentially you have two assemblies from Microsoft to help build ASP.NET MVC Web Applications:
- System.Web.Mvc - The assembly that is installed with the ASP.NET MVC Framework
- Microsoft.Web.Mvc - The assembly that you download separately as a part of ASP.NET MVC Futures
Make sure you download the ASP.NET MVC Futures as there are a number of goodies. One in particular worth mentioning that I tend to use is an extension method on HtmlHelper, called RenderAction.
Html.RenderAction
Html.RenderAction is used for calling an action on a controller and having the output displayed in the main view making the call. Hence you would do something like:
<% Html.RenderAction<MyController>(m => m.LatestNews()); %>
This little beauty calls the LatestNews Action on MyController and outputs the HTML into the current view.
This is different from RenderPartial which typically renders a partial view, but passes Model Data from the current view:
<% Html.RenderPartial("MyPartialView", Model.Data); "%>
There are a lot of other goodies in the ASP.NET MVC Futures Assembly, Microsoft.Web.Mvc, that you will want to check out.
Download it here.
ASP.NET MVC Tutorials