Ask a Question related to ASP.NET General, Design and Development.
-
steven shingler #1
order of event firing problem
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
steven shingler Guest
-
Click Event Not Firing
In Framework 1.1 (VS 2003, C#) I've written a server control that contains a button. If I place the control on a page surface, it renders fine and... -
event firing problem
Hi IN my asp.net application (C#.net) i've grid control whith pagerstyle mode=numericpages. in codebehind page i've events for... -
'itemcommand' event not firing
Hi All, I've been on this problem for many hours now and checked many posts and forums but can still not find an answer. I hope someone can help.... -
server event not firing
I have a form with a single field and a submit button with a server event. If I click the submit button, the event runs and everything is fine, if... -
OnItemDataBound event not firing
I am creating a Templated Data-Bound control. When the DataBind() method is called I would like the OnItemDataBound to fire. I can tell something... -
Marina #2
Re: order of event firing problem
I would recommend you not do things like:
<td><%= ex_lang.getText("5")%></td>
Instead, use server side controls, and have a function which populates them
with the correct data.
In general, I recommend you stay away from server side scripts like that,
and keep all your code in the codebehind.
"steven shingler" <steven.shingler@virgin.net> wrote in message
news:95acc33d.0308010733.35b10d50@posting.google.c om...> 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
Marina Guest



Reply With Quote

