I've recently started playing with MVC4, and i'm now on to partial views.
I currently have a controller like so:
public class BlogController : Controller
{
[ChildActionOnly]
public ActionResult MostRecent()
{
...
}
}
And then I call that from any one of my views using the following line:
@{ Html.RenderAction("MostRecent", "Blog"); }
Is it possible to do something like this:
public static class PartialHelper
{
public static string RenderMostRecent()
{
return notsurewhat.RenderAction("MostPopular", "Blog");
}
}
so that in my code all i have to call is:
@PartialHelper.RenderMostRecent()
That way I can change the controller / action at any point and I don't have to update everywhere that calls that partial view.
Open to ideas if there is a much easier way to do this!
Thanks