Tuesday 18 September 2012

Change Layout(Master Page) of view in ASP.NET MVC without recreate it

 In MVC3 you have _ViewStart.cshrml that store all pages Layout, you can change this element to change all pages Layout or you can add new Layout element in top of target view pages in @{} block like the following to change the layout of the specific page:
@{
Layout = "~/Views/Shared/_newLayout.cshtml";
ViewBag.Title = "Index";
}

No comments:

Post a Comment