How to Set Master Page dynamically?
问题 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... 回答1: 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