Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two master page
1.Admin.Master
2.Operator.Master
and two content page
1.Default1.aspx
2.Default2.aspx
Both content pages inherits <codeadmin.master> page.But when I login through Operator both content page inherit <code>Admin.Master ,I want both page should inherit Operator.Master page.
Posted
Updated 4-Dec-11 18:13pm
v2

I think you want to change the master page dynamically. You can add a Pre_Init method in your page and in that method you can change the master page. Like

C#
protected void Page_PreInit(object sender, EventArgs e)
{
    this.Page.MasterPageFile = "~/Operator.master";

}


You also can put some condition in the above method if require.
 
Share this answer
 
Codeproject article will help Interaction Between Content Page and Master Page[^]
 
Share this answer
 
 
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