I want to change language with LinkButton in my project
<asp:LinkButton ID="LinkButton1" runat="server"
PostBackUrl="~/mypage.aspx?lang=en">english</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server"
PostBackUrl="~/mypage.aspx?lang=ru">русский</asp:LinkButton>
For this page I created local resources
mypage.aspx.resx
mypage.aspx.ru.resx
when I press this linkbutton nothing happens
try to add this code to your Page_Load event (it will be more effective if you use a base class for your pages, and put this code into that base page, so that all pages in the application will be able to switch language)
if(Request.QueryString["lang"] == "en")
{
var english = new CultureInfo("en");
System.Threading.Thread.CurrentThread.CurrentCulture = english;
System.Threading.Thread.CurrentThread.CurrentUICulture = english;
}
else if(Request.QueryString["lang"] == "ru")
{
var russian = new CultureInfo("ru");
System.Threading.Thread.CurrentThread.CurrentCulture = russian;
System.Threading.Thread.CurrentThread.CurrentUICulture = russian;
}
Be aware that also date formats as well as number (and currency) formats will change accordingly, if you don't force the format.