I have in my project mainMaster page were locates imageButtons:
<asp:ImageButton ID="RU" ImageUrl="/Images/RU.png" runat="server" onclick="RU_Click">
<asp:ImageButton ID="USA" ImageUrl="/Images/USA.png" runat="server" onclick="USA_Click" />
here's OnClick functions:
protected void RU_Click(object sender, ImageClickEventArgs e)
{
Session["MyCulture"] = CultureInfo.CreateSpecificCulture("ru-RU");
Server.Transfer(Request.Url.LocalPath);
}
protected void USA_Click(object sender, ImageClickEventArgs e)
{
Session["MyCulture"] = CultureInfo.CreateSpecificCulture("en-AU");
Server.Transfer(Request.Url.LocalPath);
}
also I have two .resx files but how cane I link press buttons with
<asp:Literal ID="Literal1" runat="server" Text="<%$ Resources:Main, Name%>" />
Your question is not clear, but let me clear one thing up for you that might be your problem.
You can set Culture only in the InitializeCulture event:
protected override void InitializeCulture()
{
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-AU");
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-AU");
base.InitializeCulture();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With