Last post Jan 09, 2009 07:17 PM by smiling4ever
Jan 09, 2009 06:07 PM|xavierx|LINK
I have this website which has a header and a footer control and i have created a cookie in a global var store that initializes the cookie and sets a langid key to "en-ca"
Now in the header control i have this change language button to change from french to english. In each page i have set the labels appropriately and in Page_Load I call the LoadLabels method which is all fine.
My issue I am having is that I must be missing something because it does not toggle between the languages immediately but instead after clicking a different link on the site.
For example when i click the change language button which is stored in the header control it sets the cookie but does not refresh the page
until i navigate to a new page and then back to the original will it change all the text to french.
On page load of the content pages I have it call a changeLang function which sets the culture and then call the LoadLabels funtion
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture
How do i make it so when i click change language it immediately changes the culture and changes all the labels. It seems to change the language but only until next pageload does it apply the new changes. Simply setting the currentculture and currentuiculture
does not do anything. It is almost like i need a double reload but that wont work either.
Jan 09, 2009 07:17 PM|smiling4ever|LINK
Insert your code
Thread.CurrentThread.CurrentCulture = New CultureInfo(Server.HtmlEncode(Request.Cookies("LangInfo")("LangID")))
inside the Application_BeginRequest