Master page)

Source: Internet
Author: User

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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.