简体   繁体   中英

Remove all currently applied styles for a ContentPlaceHolder in child page?

I want to remove all styles that were applied by master page for a content place holder, but do it in code within the child page. I tried to use the following, but it did nothing.

  protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ContentPlaceHolder mpContentPlaceHolder = (ContentPlaceHolder)Master.FindControl("cphCenterColumn");
            mpContentPlaceHolder.EnableTheming = false;

        }
    }

Themes need to be changed no later than in Page_Init in the page lifecycle .
Try moving the code to the Page_Init or Page_PreInit event instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM