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

In MVC3 you have _ViewStart.cshtml that stores 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";
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)