Can I change the master page of a webpage?
A. when creating aspx, you have attached a master page. aspx dynamically changes the master page (MasterPage), that is, in. when aspx is displayed, it can be dynamically switched to another master page.
The following Insus. NET attempt seems to be successful.
First, create two masterpages on the website: MasterPage1.master and MasterPage2.master.
Create a. aspx file, such as Default. aspx, which is appended to MasterPage1.master:
The following are the key points. The only way to switch the webpage to Masterpage2.master is to dynamically modify the value of MasterpageFile.
View:
Wow, there is an error, but it prompts us how to solve it and moves it to the OnPreInit event. That is to say, to dynamically update this attribute, We need to pre-process it before the Page_PreInit event. OK,
Browse again: