Reputation: 387
I am new in MS MVC3.I am using C# with razor view engine in MVC3. There is a 'shared' folder (in MVC3 framework) where a _Layout.cshtml file that sharing by other views file. But how could i create more file as like _Layout.cshtml? how can i add and use more than one _Layout.cshtml file that will share the design by a specific view file, please let me know step by step because i am new in MVC3. and sorry for my bad English.
Upvotes: 0
Views: 324
Reputation: 32768
You can create as many Layouts
as you want. The default layout of the views is set in the _ViewStart.cshtml
file.
If you want to use a different layout in a view, all you have to do is set the Layout
property at the start of the view.
@{
Layout = "~/Views/Shared/_MyLayout.cshtml";
}
Upvotes: 2
Reputation: 191
If you right click on the folder in the solution explorer it will give you a menu that will say add->. If you select "new" a popup will give you a list and you can select Layout View form the menu. Once you select to add a View you can select what layout from the drop down list.
Upvotes: 1