Last post Nov 21, 2006 12:26 PM by ferrethouse
Nov 20, 2006 07:02 PM|ferrethouse|LINK
I swear I had this working but now it is not. If I change the browser language then the proper resource file is used and the text shows up in french or english. I also have two flags on the page, however, and when the user clicks on the flag it is supposed
to show the appropriate language. It is not. Below is the relevent code.
First we have the page declaration...
<%@ Page Language="vb" AutoEventWireup="false" Inherits="ERSWeb.AnalysisMain" CodeFile="AnalysisMain.aspx.vb" Culture="auto" UICulture="auto" CodeFileBaseClass="ERSWeb.BasePage" meta:resourcekey="PageResource1" %>
Next we have the click events for the flags...
Protected Sub LanguageEN_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles LanguageEN.Click
Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("en-CA")
Protected Sub LanguageFR_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles LanguageFR.Click
Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("fr-CA")
Nov 21, 2006 12:26 PM|ferrethouse|LINK
The problem is that the page inherits from a base class. Therefore, the InitializeCulture sub is fired before any of the events on the main page. I figured out a workorder using a session variable and response.redirect to itself.
Kind of cheesy but I don't know any other way around it.