Is it possible to assign a Master Page dynamically?
+5
A:
Assign the master page in PreInit
of the page whos MasterPage
you wish to dynamically set:
protected void Page_PreInit(Object sender, EventArgs e)
{
this.MasterPageFile = "~/YourMaster.master";
}
GenericTypeTea
2010-09-15 10:22:37
seems so simple, i like it
Spooks
2010-09-15 12:40:28
+1
A:
You can assign the master page during the Page_PreInit
by using the MasterPageFile
property.
Me.MasterPageFile = "~/masterpage.master"
Jake1164
2010-09-15 10:23:40