I have requirement in which i want to set different Master Pages for the Same Page depending upon userid(i.e. for one user it must set one master page and for another user it must set another master ).Can we set different Master pages for any page dynamically?Please help...
void Page_PreInit(Object sender, EventArgs e)
{
this.MasterPageFile = "~/MyMaster.master";
}
Explanation: 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With