You are right: first onload fires, and then the button click.
The easiest way to overcome this, is to move your logic to a separate sub
or function and call that from both the onclick as from the onload. The
following pseudo code clarifies what I mean:
Page_OnLoad()
UpdateMyLabel()
End Page_Onload()
Button_OnClick()
Session("MySessionVariable") = WhateverYouNeedToDoToGetAValue()
UpdateMyLabel()
End Button_OnClick()
UpdateMyLabel()
Label1.Text = Session("MySessionVariable")
End UpdateMyLabel()
Hope this makes sense to you.
Cheers,
Imar
At 12:52 PM 10/31/2002 -0500, you wrote:
>Hi all, I have written a click event for one button in which I update a
>session variable and in the load event of the page I display the session
>variable in a label. The problem is that I found that when I do the
>click the label doesn't change in the first click but in the second. I
>don't know if I am right, but I think that the load event occurs before
>the click and therefore the label does not update until the next click
>when yet the session variable have the value. Any suggestions would be
>extremely appreciated.
>
>
>---