【发布时间】:2013-01-31 13:15:13
【问题描述】:
我有一些旧的 sitecore asp net 应用程序。 而且我发现在布局(aspx)上我有应该改变网站语言的 ImageButton 控件。
protected void btnLanguage_Click(object sender, EventArgs e)
{
ImageButton flag = (ImageButton)sender;
if (string.IsNullOrEmpty("") == false)
{
UserContext.CurrentCulture = LanguageManager.GetLanguage(flag.CommandArgument);
}
else
{
SC.Context.Language = LanguageManager.GetLanguage(flag.CommandArgument);
}
}
但我有很多控件需要在调用此事件后进行翻译。通过 asp 网页生活方式过程,这不是好的行为,但无论如何我需要用它做点什么。在我的情况下,最好的方法是什么?应该如何以正确的方式完成?
【问题讨论】:
-
想到的最快方法是将语言保存在 Session 中并从各种控件访问它(当主页回发时,它们都应该获得页面加载事件,因此您可以检查那里)。
-
谢谢。是的,这是想法。但是正确的方法呢?
标签: asp.net sitecore sitecore6