Event fire order

  • Thread starter Thread starter Gav
  • Start date Start date
G

Gav

Hi all,

I have written a UserControl for the use as a mini shopping cart/basket on
my website, I am saving the items in a Session variable.

My problem is that when the add item button is clicked the Page_Load event
in the UserControl is fired before the add button_click. So the page has to
be refreshed before it shows the item in the UserControl.

Does anyone know what I can do to fix this?

Thanks
Gav
 
Hi Gav,
I have written a UserControl for the use as a mini shopping cart/basket on
my website, I am saving the items in a Session variable.

My problem is that when the add item button is clicked the Page_Load event
in the UserControl is fired before the add button_click. So the page has
to be refreshed before it shows the item in the UserControl.

Server events are raised after the page has loaded, on the server. If
ASP.NET raised the button's click event before the page finished loading
then there could be all sorts of problems.

Note that the "refresh" occurs on the server, not the client.
Does anyone know what I can do to fix this?

What do you need fixed? This is the normal, appropriate behavior for server
events.

ASP.NET Page Life Cycle Overview
http://msdn2.microsoft.com/en-us/library/ms178472.aspx

Note how "Postback event handling" occurs after "Load" in the article cited
above.
 
Back
Top