473,399 Members | 3,106 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,399 software developers and data experts.

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
Nov 17 '05 #1
1 1436
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" <st*************@virgin.net> wrote in message
news:95**************************@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

Nov 17 '05 #2

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

Similar topics

2
by: Pete | last post by:
I have some funky form/event behavior. Access 97. Split frontend/backend, using Access security. I have the same behavior (or lack of behavior) for the pag_Click() event of two separate pages...
13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
7
by: Dan Nash | last post by:
Hi guys Ok, i have an aspx with a user control. In the user controls pageload i set a property (mystring = "test";). i then want to access that from the page_load of the aspx thats using the...
2
by: Dan | last post by:
I have an aspx page with a form on it. There are a couple of textboxes and an ImageButton. The page is loaded from another page using Server.Transfer. When I click on the ImageButton, the...
5
by: Engineerik | last post by:
I have a login form which I want to display with the showdialog method. When I do that the event handler for the load event does not run. If I use the show method the load event handler runs...
3
by: Brett | last post by:
I'm using a third part component in a certain app. The component has methods and events. I noticed one particular event was not firing after a while but it should have been. The problem was the...
8
by: Frank van Vugt | last post by:
Hi, If during a transaction a number of deferred triggers are fired, what will be their execution order upon the commit? Will they be executed in order of firing or alfabetically or...
0
by: hazz | last post by:
I would like to have control over datagridview events so that when a user 'single clicks' anywhere on the grid, a method call is made to a service and if a user 'double clicks' a Customer detail...
5
by: jaysonnward | last post by:
Hello All: I've recently been recreating some 'dropdown menus' for a website I manage. I'm writing all my event handlers into my .js file. I've got the coding to work in Firefox, but the...
1
by: =?Utf-8?B?TWlrZXkgQmFieQ==?= | last post by:
Greetings Hopefully, I can be clear and concise on this one, but I'm confused. I have a page with a ListBox <- ODS <- BusinessObject and a button. The Parameter Source is 'None'. The Default...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.