简体   繁体   中英

Change a master pages footer source programatically

I have an ASP webform which consists of a MasterPage with a header and footer control and my content placeholder.

I have a link within the header which triggers a change of language culture by altering the query string of the Uri.

This all works perfectly well, however my footer contains a few fields which are currently separate to all this.

What I would like to do is on the Page_Load for MasterPage if the current threads culture is Welsh, point at the Welsh version of my footer, however I do not know how to get a handle on the footer's source.

    if (Thread.CurrentThread.CurrentCulture.ToString() == "cy-GB")
    {
        string debug = Footer1.ToString();                
    }

When I change the language and inspect the debug string I can see the value is: ASP.components_footer2_ascx my idea is to change this to ASP.components_footer2_cy_gb_ascx How can I redirect the source of the footer within this if statement?

可以将两个ascx对象添加到母版,然后在page_load中检查威尔士文化,并使相关的ascx对象可见或不可见吗?

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