简体   繁体   English

以编程方式更改母版页脚源

[英]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. 我有一个ASP Web表单,其中包含一个带有页眉和页脚控件的MasterPage和我的内容占位符。

I have a link within the header which triggers a change of language culture by altering the query string of the Uri. 我在标题内有一个链接,该链接通过更改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. 如果当前线程区域为威尔士语,我想在MasterPagePage_Load上指向我的页脚的威尔士语版本,但是我不知道如何获取页脚源代码。

    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? 当我更改语言并检查调试字符串时,我看到的值是: ASP.components_footer2_ascx我的想法是将其更改为ASP.components_footer2_cy_gb_ascx如何在if语句中重定向页脚的源?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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