S
steven shingler
Hi all,
Would really appreciate some help on this one!
Am trying to make a multilingual site with a button to toggle between
English and Welsh.
Have an imagebutton with an onclick event to handle the toggle:
private void changeLanguage(object sender,
System.Web.UI.ImageClickEventArgs e)
{
if(Session["Language"].ToString()=="English")
Session["Language"] = "Welsh";
else
Session["Language"] = "English";
}
The aspx page contains a load of things like this:
<td><%= ex_lang.getText("5")%></td>
Which draws in the relevant text from an xml file, picking the correct
language node according to the Session["Language"]
The (very weird) problem is that if I hit the button once, nothing
happens. If I hit it a second time - and every subsequent time - it
behaves perfectly, translating the text as the page loads.
I know that Page_Load is called before the click event, and I guess
that's why this is happening, but how can I prevent this delay?
I hope I've explained this well enough, if anyone has any suggestions
I'd really love to hear them.
Many Thanks
Steven Shingler
Would really appreciate some help on this one!
Am trying to make a multilingual site with a button to toggle between
English and Welsh.
Have an imagebutton with an onclick event to handle the toggle:
private void changeLanguage(object sender,
System.Web.UI.ImageClickEventArgs e)
{
if(Session["Language"].ToString()=="English")
Session["Language"] = "Welsh";
else
Session["Language"] = "English";
}
The aspx page contains a load of things like this:
<td><%= ex_lang.getText("5")%></td>
Which draws in the relevant text from an xml file, picking the correct
language node according to the Session["Language"]
The (very weird) problem is that if I hit the button once, nothing
happens. If I hit it a second time - and every subsequent time - it
behaves perfectly, translating the text as the page loads.
I know that Page_Load is called before the click event, and I guess
that's why this is happening, but how can I prevent this delay?
I hope I've explained this well enough, if anyone has any suggestions
I'd really love to hear them.
Many Thanks
Steven Shingler