custom event handler

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?
 
R

Richard K Bethell

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top