Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I prevent a Content Page from inheriting the Master Page conditionally at run-time?
Posted

1 solution

You can attach a master page dynamically to a content page. Because the master page and content page are merged during the initialization stage of page processing, a master page must be assigned before then. Typically, you assign a master page dynamically during the PreInit stage.
C#
void Page_PreInit(Object sender, EventArgs e)
{
    this.MasterPageFile = "~/MyMaster.master";
}

Please note this article on MSDN:

http://msdn.microsoft.com/en-us/library/c8y19k6h.aspx

Thanks,
-RG
 
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