473,378 Members | 1,680 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Culture/Resource problem

DESIGNER:

<asp:Button runat="server" ID="b1" Text="<%$ Resources:Products,
PopularProducts %>" />

CODE BEHIND:

protected void Page_PreRender(object sender, EventArgs e)
{
Response.Write(Resources.Products.PopularProducts) ;
}

These two should both be linking to the same resource, but the problem is
that only the one in code behind writes the correct language. The first one
always gets the text from the default resource file and not the one with the
current/correct culture. I have set the current thread's cultures in the
base-page. Why isn't the two examples giving the same value?

Twh
Mar 20 '06 #1
2 1040
timing. you are proably setting the culture in onload, but

<asp:Button runat="server" ID="b1" Text="<%$ Resources:Products,
PopularProducts %>"

is processed prior to onload, while prerender is long after. change your
code to use binding or move the text assignment to the code behind.

-- bruce (sqlwork.com)
"Thor W Hammer" <th*********@hotmail.com> wrote in message
news:44******@news.broadpark.no...
DESIGNER:

<asp:Button runat="server" ID="b1" Text="<%$ Resources:Products,
PopularProducts %>" />

CODE BEHIND:

protected void Page_PreRender(object sender, EventArgs e)
{
Response.Write(Resources.Products.PopularProducts) ;
}

These two should both be linking to the same resource, but the problem is
that only the one in code behind writes the correct language. The first
one always gets the text from the default resource file and not the one
with the current/correct culture. I have set the current thread's cultures
in the base-page. Why isn't the two examples giving the same value?

Twh

Mar 20 '06 #2
Thank you, I changed it and set the culture in the InitCulture method and
now it works.

By the way, can you tell me how to read a local resource from code-behind ?

Twh
"Bruce Barker" <br******************@safeco.com> wrote in message
news:u3**************@tk2msftngp13.phx.gbl...
timing. you are proably setting the culture in onload, but

<asp:Button runat="server" ID="b1" Text="<%$ Resources:Products,
PopularProducts %>"

is processed prior to onload, while prerender is long after. change your
code to use binding or move the text assignment to the code behind.

-- bruce (sqlwork.com)
"Thor W Hammer" <th*********@hotmail.com> wrote in message
news:44******@news.broadpark.no...
DESIGNER:

<asp:Button runat="server" ID="b1" Text="<%$ Resources:Products,
PopularProducts %>" />

CODE BEHIND:

protected void Page_PreRender(object sender, EventArgs e)
{
Response.Write(Resources.Products.PopularProducts) ;
}

These two should both be linking to the same resource, but the problem is
that only the one in code behind writes the correct language. The first
one always gets the text from the default resource file and not the one
with the current/correct culture. I have set the current thread's
cultures in the base-page. Why isn't the two examples giving the same
value?

Twh


Mar 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Craig | last post by:
Hi I'm creating a web control whereby I use a resource file to store strings for property descriptions and so forth. The namespace for the control is: Unsd.Web.WebControls all classes in the...
0
by: Ajoy Kumar | last post by:
Hi, Firstly, I have created an Assembly with RlinkPMBAPIRes.dll Secondly, I have created an Assembly with TestRes.exe which is the calling application. 1. RlinkPMBAPIRes RlinkPMBAPIRes...
2
by: JezB | last post by:
How do I programatically set the culture at session level ?
4
by: Henke | last post by:
Hi I'm building an globalized application (english, swedish and russian languages) and have a few questions: 1. In order to see the russian characters correct I have to set the requestEncoding...
3
by: BBC1009 | last post by:
Don't know why when rebuild VB.Net project (vb.net 2002 framework 1.0), this error comes out suddenly. Anyone can help. Thanks!!!!
0
by: Rob Dob | last post by:
Hi, I have a VS2003 C# asp.net project that has been converted into a VS2005 project. Everything seemed to work well until I make a modification to anything within the Component Designer...
2
by: Thor W Hammer | last post by:
DESIGNER: <asp:Button runat="server" ID="b1" Text="<%$ Resources:Products, PopularProducts %>" /> CODE BEHIND: protected void Page_PreRender(object sender, EventArgs e) {...
0
by: Bob | last post by:
I have a class in a VB.net 2005 project that is supposed to get strings from a ressource file depending on the culture. This is the code for the class Imports System Imports...
5
by: Sajit | last post by:
Hi, Could anyone provide any suggestions on how to implement localization features for a multilingual website. Before you jump the guns, let me define the site structure a little more. We have a...
0
by: nathanb | last post by:
Hi, I have a slight problem, I have a sight, which has Internationalisaton using the Global Resources folder, and different cultures per language. For example I have a Jobs page, and...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.