Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please anybody tell me can I give refrence of two or more master pages to a web form using master page in visual studio 2010??
Reply me soon...
Posted
Updated 24-Jan-14 2:30am
v2
Comments
Sampath Lokuge 24-Jan-14 9:01am    
What's the purpose of this ?
Stephen Hewison 24-Jan-14 9:40am    
It's not designed to have more than one master page. A master page can't have a master page, so you can't nest master pages in that way. I'd suggest your approach is wrong. If you explain the problem you may get a workable solution.
Member 10546758 26-Jan-14 11:22am    
I build a quiz project which is being used by 3 users admin, faculty and student.Admin can view all forms and std can view one or two for example Start quiz form and the faculty can view its own forms as well as students form.Now what way should I use to do this??

As the others said, you can't have 2 master pages for one page, nor can a master page inherit from another master page.
 
Share this answer
 
Try to use pre_int page event for doing this functionality.

C#
protected void Page_PreInit(object sender, EventArgs e) 
{ 
 if ('Your Condition' == null) 
    this.Page.MasterPageFile = "~/Master1.master";
 else
    this.Page.MasterPageFile = "~/Master2.master";
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900