Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can i have multiple site.master files in asp.net mvc

i have a number of files that i want to have the same "base" layout so i am using the site.master file for this and its working perfectly. but now i want another set of pages with a different "site.master" file. can i have multiple site.master files in one solution

like image 945
leora Avatar asked Aug 16 '09 15:08

leora


People also ask

Can we have more than one master page in asp net?

You can nest as many master pages as you would like.

Can one have more than one master page in a project?

Yes you can use multiple master page but at a time one master page should be referenced. You can inherits multiple master page at code behind by specifying the master page in the pre_Init event of page life cycle.

Can we add more than one master page in a website?

If you want a Master Page, you can add the page (Web Forms Master Page) from Add+New item (Ctrl+Shift+A). Now, you can add two Master Pages in your Project Solution Explorer. Here, we can add some webform, like Home page,Technology page and extra. Here, open the default .

How many master pages can you have in asp net?

In ASP.NET, you can have multiple master pages each for a different purpose. You can provide users several layout options using Multiple Master Page. You can define Master Page at multiple places in the web application.


1 Answers

Yes. Just put the masters in the Shared folder along with the Site.master file and change the reference in the new View pages. You can do this by replacing the "Site.master" string for the Master Page or selecting the master page from the wizard when creating new views.

like image 190
andymeadows Avatar answered Sep 30 '22 03:09

andymeadows