Hi,
I'm developing a web site using asp.net with C#, this site contains a MasterPage, UserControles, Pages.
What i need to do is to make my site supports MultiLanguage, so I put a dropDownList in my MasterPage, But the language doesn't change when I switch between them, Here is my code (Only pages that inherit from MasterPage):
/******************** MasterPage.master ********************/
-
-
<asp:DropDownList ID="cmbCulture" runat="server" AutoPostBack="True" Font-Bold="True"
-
ForeColor="#3F3F3F" Width="200px">
-
<asp:ListItem>Auto</asp:ListItem>
-
<asp:ListItem Value="ar-EG">Arabic</asp:ListItem>
-
<asp:ListItem Value="en-US">English</asp:ListItem>
-
</asp:DropDownList>
-
and I use a BaseClass, That I inherit from instead of inherit from a page like that:
/******************** BaseClass.cs ********************/
-
protected override void InitializeCulture()
-
{
-
string culture = Request.Form["cmbCulture"];
-
if (string.IsNullOrEmpty(culture))
-
culture = "Auto";
-
//Use this
-
UICulture = culture;
-
Culture = culture;
-
//OR This
-
if (culture != "Auto")
-
{
-
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo(culture);
-
System.Threading.Thread.CurrentThread.CurrentCulture = ci;
-
System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
-
}
-
-
base.InitializeCulture();
-
}
-
/******************** Page.aspx ********************/
-
public partial class administrator_NewUser : BaseClass
-
{
-
protected void Page_Load(object sender, EventArgs e)
-
{
-
-
}
-
}
-
NOTE:
The Default Page doesn't inherit from the Master page, but inherit the BaseClass, and it works fine.
The problem with pages that inherit from MasterPage !!
ANY IDEAS !!