I have a button which sets a vaiable in session. I retrieve the session the
page load event. I seem to need to press the button twice for the variable
to change (I am tracing it to see what the variable is). I am I
misunderstanding something?
The variable only seems to change further down the order of events. Any
ideas . Cheers, Chris.
Chris,
chech out the lifecycle of the page. The button click event fires AFTER the
page.Load event which is why your have to click your button twice.
For a little background reading you might have a look at the following
article:
http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnaspp/html/a
spnet-pageobjectmodel.asp
Regards
Daniel Walzenbach
>I have a button which sets a vaiable in session. I retrieve the session the
> page load event. I seem to need to press the button twice for the variable
[quoted text clipped - 3 lines]
> The variable only seems to change further down the order of events. Any
> ideas . Cheers, Chris.
Chris Kennedy - 22 Jul 2005 20:27 GMT
It's a little long winded to explain what I am doing. I want the button
click to do something to an XML file before the page reloads. I now
understand this is not how the postback process works. Is there any way of
triggering the postback twice. I know its a hack.....
> Chris,
>
> chech out the lifecycle of the page. The button click event fires AFTER the
> page.Load event which is why your have to click your button twice.
> For a little background reading you might have a look at the following
> article:
http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnaspp/ht
ml/aspnet-pageobjectmodel.asp
> Regards
>
[quoted text clipped - 7 lines]
> > The variable only seems to change further down the order of events. Any
> > ideas . Cheers, Chris.
Try moving your code after events are fired, i.e. PreRender event and see if
that works for you.

Signature
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Read my weblog:
Followers of the IHttpHandler
http://clariusconsulting.net/vga
>I have a button which sets a vaiable in session. I retrieve the session the
> page load event. I seem to need to press the button twice for the variable
[quoted text clipped - 3 lines]
> The variable only seems to change further down the order of events. Any
> ideas . Cheers, Chris.
Can u post some snippets?
>I have a button which sets a vaiable in session. I retrieve the session the
> page load event. I seem to need to press the button twice for the variable
[quoted text clipped - 3 lines]
> The variable only seems to change further down the order of events. Any
> ideas . Cheers, Chris.