Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 299685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:50:43+00:00 2026-05-12T06:50:43+00:00

I’m using the Resource expression directives in an ASP.NET page that has four global

  • 0

I’m using the Resource expression directives in an ASP.NET page that has four global resource files, neutral, UK, US and Italian. However, using the expression syntax always returns US.

Some code for the ASPX page:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="GlobalisationResources._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2>Current culture: <%= System.Threading.Thread.CurrentThread.CurrentUICulture.Name + " - " + System.Threading.Thread.CurrentThread.CurrentCulture.Name %></h2>
        <h2>At page load: <asp:Literal ID="PageLoadLiteral" runat="server" /></h2>
        <h2>At initialise culture: <asp:Literal ID="InitCultureLiteral" runat="server" /></h2>
        <asp:DropDownList AutoPostBack="true" runat="server" ID="LangDropDown" />
        <br />      
        Using resources processor command: <span><asp:Literal runat="server" Text="<%$ Resources: SomeResources, Banana %>" /></span>
        <br />
        GetGlobalResourceObject: <span><%= GetGlobalResourceObject ("SomeResources", "Banana") %></span>
        <br />
        Typed: <span><%= Resources.SomeResources.Banana %></span>       
        <br />      
        <br />      
        ORANGES! Using resources processor command: <span><asp:Literal runat="server" Text="<%$ Resources: SomeResources, Orange %>" /></span>
        <br />
        ORANGES! GetGlobalResourceObject: <span><%= GetGlobalResourceObject ("SomeResources", "Orange")%></span>
        <br />
        ORANGES! Typed: <span><%= Resources.SomeResources.Orange %></span>      
    </div>
    </form>
</body>
</html>

The code behind:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using System.Globalization;

namespace GlobalisationResources
{
    public partial class _Default : Page
    {
        string mCulture;

        protected void Page_Load (object sender, EventArgs e)
        {
            LangDropDown.SelectedIndexChanged += LangDropDown_SelectedIndexChanged;

            if (!IsPostBack)
            {
                LangDropDown.Items.Add ("en-US");
                LangDropDown.Items.Add ("en-GB");
                LangDropDown.Items.Add ("it-IT");
            }

            PageLoadLiteral.Text = Thread.CurrentThread.CurrentUICulture.Name + " - " + Thread.CurrentThread.CurrentCulture.Name;
            InitCultureLiteral.Text = mCulture;
        }

        override protected void InitializeCulture ()
        {
            mCulture = Thread.CurrentThread.CurrentUICulture.Name + " - " + Thread.CurrentThread.CurrentCulture.Name;

            base.InitializeCulture ();
        }

        void LangDropDown_SelectedIndexChanged (object sender, EventArgs e)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture (LangDropDown.Text);
            Thread.CurrentThread.CurrentUICulture = new CultureInfo (LangDropDown.Text);
        }
    }
}

As you can see, the user can change the language at any time, and at the top of the page I print out the culture at various stages, the results are:

At first request:

Current culture: en-US – en-GB
At page load: en-US – en-GB
At initialise culture: en-US – en-GB

When selecting GB:

Current culture: en-GB – en-GB
At page load: en-US – en-GB
At initialise culture: en-US – en-GB

And for IT:

Current culture: it-IT – it-IT
At page load: en-US – en-GB
At initialise culture: en-US – en-GB

I don’t know if those results have any impact on the use the Resources syntax or not, but does anyone know why it would always pick up the wrong values when everything else (GetGlobalResourceObject and typed) always work?

P.S. I’m in the UK, and my region is set to UK too.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:50:44+00:00Added an answer on May 12, 2026 at 6:50 am

    I think your culture not set properly
    set using like.. and plz let me know

    protected override void InitializeCulture()
    {
        Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
        Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
        base.InitializeCulture();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I've got a string that has curly quotes in it. I'd like to replace
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.