Answered by:
Problem with localization.

Question
-
User-386593322 posted
Hi All!
I use localization in my website, but I have a problem. In my page I have two dropdownlists (with one change languages) and some labels(some of then whit Visible="false"). When second dropdown list's SelectedIndexChanged fired the invisible label become visible and localization works, but when i change the language from the dropdown, only those labels that were not hidden to respond, to those who were previously hiddenare not translated into the specified language.Here is my codebehind:
public partial class Admin2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string currentLanguage = Request.QueryString["val"].ToString(); languageList.SelectedValue = currentLanguage; } } protected override void InitializeCulture() { base.InitializeCulture(); string currentLanguage = Request.QueryString["val"].ToString(); if (currentLanguage != null) { Culture = currentLanguage; UICulture = currentLanguage; } string cult; cult = Request["languageList"]; if (cult != null) { Culture = cult; UICulture = cult; } } protected void actionList_SelectedIndexChanged(object sender, EventArgs e) { Response.Write(languageList.SelectedValue); if (actionList.SelectedValue == "Add new" || actionList.SelectedValue == "Добавяне") { identifierNameLabel.Visible = true; identifierName.Visible = true; editingItemLabel.Visible = false; editingItemList.Visible = false; recordLanguage.Visible = false; } else { editingItemLabel.Visible = true; editingItemList.Visible = true; recordLanguage.Visible = true; identifierNameLabel.Visible = false; identifierName.Visible = false; } }
Thursday, April 28, 2011 8:10 AM
Answers
-
User-386593322 posted
I solve the problem, here is the decision, some may face the same problem and I'll behappy if my thread its benefit
protected void actionList_SelectedIndexChanged(object sender, EventArgs e) { if (actionList.SelectedValue == "Add new" || actionList.SelectedValue == "Добавяне") { identifierNameLabel.Text = Resources.LanguageStrings.identifierNameLabelText; identifierName.Visible = true; editingItemLabel.Text = ""; editingItemList.Visible = false; recordLanguageList.Visible = false; recordLanguageLabel.Text = ""; } else { editingItemLabel.Text = Resources.LanguageStrings.editingItemLabelText; editingItemList.Visible = true; identifierNameLabel.Text = ""; identifierName.Visible = false; } }
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, April 28, 2011 3:50 PM
All replies
-
User191633014 posted
try to set also and Thread.CurrentThread.CurrentCulture
UICulture = cult; Culture = cult; Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(cult); Thread.CurrentThread.CurrentUICulture = new CultureInfo(cult);
Thursday, April 28, 2011 9:35 AM -
User-386593322 posted
Not working.
However, thanks for the quick response.
Thursday, April 28, 2011 10:23 AM -
User-386593322 posted
I solve the problem, here is the decision, some may face the same problem and I'll behappy if my thread its benefit
protected void actionList_SelectedIndexChanged(object sender, EventArgs e) { if (actionList.SelectedValue == "Add new" || actionList.SelectedValue == "Добавяне") { identifierNameLabel.Text = Resources.LanguageStrings.identifierNameLabelText; identifierName.Visible = true; editingItemLabel.Text = ""; editingItemList.Visible = false; recordLanguageList.Visible = false; recordLanguageLabel.Text = ""; } else { editingItemLabel.Text = Resources.LanguageStrings.editingItemLabelText; editingItemList.Visible = true; identifierNameLabel.Text = ""; identifierName.Visible = false; } }
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, April 28, 2011 3:50 PM