custom event handler

  • Thread starter Thread starter Philip Townsend
  • Start date Start date
P

Philip Townsend

I have a user control that displays the contents of a shopping cart. I
want this control to update its contents whenever an item is added to
the cart. Currently, the cart only updates if it is forced to do so
through a page reload or clicking a button within the user control
itself (thereby reloading the user control). I want to raise an event in
the user control whenever an item is added to the cart. This event
should cause the current contents of the cart to be displayed by the
user control. Any ideas? Is a custom event handler the way to go about
this? Are there any good resources on how to do this?
 
Philip Townsend said:
I have a user control that displays the contents of a shopping cart. I
want this control to update its contents whenever an item is added to
the cart. Currently, the cart only updates if it is forced to do so
through a page reload or clicking a button within the user control
itself (thereby reloading the user control). I want to raise an event in
the user control whenever an item is added to the cart. This event
should cause the current contents of the cart to be displayed by the
user control. Any ideas? Is a custom event handler the way to go about
this? Are there any good resources on how to do this?

Eieiii - I'd be careful of this. As much as asp.net seems to be an event
driven environment like desktop VB used to be, it's really just doing clever
tricks with viewstate maintenance, request/post, and some occassional
JavaScript. It would be much better if you could somehow tie the addition of
items to the cart in your cart to the button click events, or whatever is
causing the addition of the item.

I've played with custom event handlers - and that was in a desktop
application (for a calculator number pad.) .NET does not really make this
easy, and I imagine it does not get any easier trying to do it in asp.net.
 
Back
Top