Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to override a click method in a button on a form?
Message
De
18/06/2004 01:27:47
 
 
À
17/06/2004 22:37:02
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00913730
Message ID:
00914912
Vues:
13
Kevin,

>>On the debugging question, I did an example of this, and placed a breakpoint right before the equivalent of the dodefault() (the base.ClickHandler)...when I ran it and stepped through the code with the F11 key, I was able to trace all the way back to the behavior in the base class.

But this is in the sub-class, right? Mark was talking about a breakpoint in the eventhandler on the form.

>>If you have a base class with certain behavior in an event (e.g. click event) that you always want to fire, and then you want to drop that control on a form *once* and have some special behavior fire in addition to the base behavior, I would *think* you'd want to do something similar to what you do in VFP...drop the control on the form, set up a click event, in the click event put in your additional behavior, and then call the base handler.

You wouldn't need to call the base eventhandler ... it's done automatically before your code executes.

~~Bonnie


>Bonnie/Mark,
>
>Sorry for jumping in, but just wanted to share this...
>
>On the debugging question, I did an example of this, and placed a breakpoint right before the equivalent of the dodefault() (the base.ClickHandler)...when I ran it and stepped through the code with the F11 key, I was able to trace all the way back to the behavior in the base class.
>
>On Mark's other question, there's something I'm still a little confused about (maybe because I didn't quite understand the original example)...
>
>If you have a base class with certain behavior in an event (e.g. click event) that you always want to fire, and then you want to drop that control on a form *once* and have some special behavior fire in addition to the base behavior, I would *think* you'd want to do something similar to what you do in VFP...drop the control on the form, set up a click event, in the click event put in your additional behavior, and then call the base handler.
>
>(Or you could do what was described, create a subclass of the base class, put in your 2nd behavior there, and then drop the subclass on the form)
>
>But if you're dropping the base class on a form 5 times, and the 'additional behavior' is the same for all five, then definitely, I'd say you'd want to do what was described...take the base class, subclass it to put your additional behavior in, and then drop that subclass on five times. (Or maybe something like that is an opportunity to set up an interface?)
>
>Am I missing something, or is there a better way to do this? (again, sorry for jumping in, don't mean to cause confusion, I was a little hazy on this after I originally responded)
>
>Kevin
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform