Hi Juan and Dave and Everybody else,
Using <%= worked fine.
I do set culture in Web.Config.
However in my page I have a button to change language (change culture).
It is working the following way:
1. Sets default culture in web.config as "en-US" and Session("cultur e")
as that value.
2. Detects in Global.asax in Session_start if a cookie exist in client.
3. If exists changes threat culture and also Session("cultur e")
Then I use <%= Session("cultur e") %> to change URL's, database fields
and other items in my HTML page.
I have some questions about my approach:
1. Should I use threat culture in <%= ... %>?
2. Should I set threat culture in Page_Load in all pages or setting it
only in Session_Start is enough? Well, at least until the language
button is not pressed which runs a function.
3. Is there a way to change the application culture itself? Is it
better?
These are the questions I came up when building this.
I would appreciate some feedback on this.
Thank You,
Miguel
"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:no******** ***@nowhere.com :
In fact, you can probably skip the session object altogether.
<%@ Page Language="VB" %>
<%@ Import Namespace="Syst em.Globalizatio n" %>
<img src='images/<%=CultureInfo. CurrentCulture. Name%>/myImage.jpg' />
If you are setting the culture in the globalization section of web.config,
that should work even better than setting a session("cultur e") variable.
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======
"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:Oy******** ******@tk2msftn gp13.phx.gbl...
re:
However the image doesn't show up.
Try importing the globalization namespace:
<%@ Page Language="VB" %>
<%@ Import Namespace="Syst em.Globalizatio n" %>
and setting Session("cultur e") to CultureInfo.Cur rentCulture.Nam e :
<%Session("cult ure") = CultureInfo.Cur rentCulture.Nam e%>
Then, you can retrieve the image name with :
<img src='images/<%=Session("cul ture")%>/myImage.jpg' />
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======
"Shapper" <mdmoura*NOSPAM *@gmail.*DELETE 2SEND*com> wrote in message
news:uK******** ******@tk2msftn gp13.phx.gbl...
Hello,
I have this image in my HTML code:
<img src="images/en-US/myImage.jpg" />
I want to change the URL using the value of a Session variable.
<img src="images/ Session("cultur e") Value /myImage.jpg" />
This is what I did:
<img src='images/<%# Session("cultur e") %>/myImage.jpg' />
I change the " to ' because when I was using " I got an error.
I also did this to test my Session Value:
OO<% Response.Write( Session("cultur e")) %>OO
I got "OOen-USOO" which was what I was expecting.
However the image doesn't show up.
Can someone help me?
I don't know what else to do.
Thank You,
Miguel