I have a problem whereby I want to display a view differently (a different master page), depending on where it came from, but don\'t know where to start...
I have se
You can change the MasterPage by modifying the ViewResult prior to rendering. For example, a controller action could do:
public ActionResult TestMP(int? id)
{
ViewData["Title"] = "MasterPage Test Page";
ViewData["Message"] = "Welcome to ASP.NET MVC!";
ViewResult result = View("Index");
if (id.HasValue)
{
result.MasterName = "Site2";
}
return result;
}
You could accomplish the same thing with an action filter for a more generic solution.