Setting Thread.CurrentThread.CurrentUICulture in CodeBehind works not for ASP.Net Controls RRS feed

  • Question

  • User678367958 posted


    i am trying to build a multilanguage website. Therefore i have created a default.aspx page with tweo resource files. One default file and one for localizing in German.

    When i now do the following:

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim ci As New CultureInfo("de")
            Thread.CurrentThread.CurrentUICulture = ci
        End Sub

    i get my German String correctly displayed on the page. But when i now put a ASP.Net Control on my Page like

    <asp:Label ID="Label1" runat="server" Text="<%$ Resources:ApplicationStrings, String1 %>"></asp:Label>

    it shows me the String from the default Resource File (in english). But it should display it in german cause i already set the Thread UICulture to DE (German) as you can see above.


    The localization for the ASP.Net Controls seem to work on a different way. Note: I dont want to set the culture and uiculture attributes in the web.config cause i want to enable the user to select the desired language through a DropDown Control.

    How could i achive this?

    Thank you. Best regards


    Saturday, February 26, 2011 2:03 PM