Localization w/CompentArt / Change culture based on dropdown RRS feed

  • Question

  • User-768405968 posted

     (Im not sure how to turn of double spacing, so sorry in advance)

     Object: What im trying to do is add a asp style drop down list into the header of my application next to a compentArt style navagation menu that i have(this part i figured out, i believe). What I want to happen is, when the user selects a language in the drop down i want the past to postback in that language.

    Here is the code for the drop down list:








    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" meta:resourcekey="DropDownList1Resource1">

    <asp:ListItem Value="en-US" meta:resourcekey="ListItemResource1" Text="English"></asp:ListItem>

    <asp:ListItem Value="de-ch" meta:resourcekey="ListItemResource2" Text="Deutsch"></asp:ListItem>


    Problem: Im using the following code in order for the localization to take place:  

    Protected Overrides Sub InitializeCulture()

    Dim lang As String = Request("DropDownList1")

    If lang IsNot Nothing Or lang <> "" Then

    Thread.CurrentThread.CurrentUICulture = New CultureInfo(lang)

    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang)

    End If

    End Sub

    The problem is that it says, "The 'IntializeCulture' can't be declared 'Overrides' b/c it does not overide a sub in a base class". I was always uder the impression that you must have this coding in order for localization to take effect w/a drop down menu, am i missing something or have i done something wrong?  

    Thursday, July 19, 2007 12:04 PM

All replies

  • User1622957740 posted

    Where are you declaring InitializeCulture? In a page subclass?

    Friday, July 20, 2007 4:58 PM