Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
User Controls in Windows
Message
From
12/05/2004 17:48:14
 
 
To
12/05/2004 16:20:06
Jim Rieck
Quicken Loans/Rock Financial/Title Sourc
Livonia, Michigan, United States
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00903212
Message ID:
00903400
Views:
20
Jim,

>I want to know if there is a way to not call the click event on the user control when one of the buttons is clicked?

No, not the way that you're doing it. If your user control buttons have click event handlers, they will always execute. I can't think of a way to suppress that on the form. But, you do have a few options:

1) You could make sub-classes of the user control and not have click event handlers in the user control for whichever button you don't want to fire.

-or-

2) Don't have any click event handlers at all in your user control and have the click event handlers in the form execute public methods in the user control.

-or-

3) Instead of handling the clicks in the user control, you could just have the click events raise various events that you define (this is what I thought you wanted to do originally, hence the code I posted earlier). Then you can set up the appropriate delegates and event handlers in your form to execute whichever events you want to take place. You could have each button raise two events. One event could do the default stuff for that button. The other event could be used to do only what you need to do from the form.

Anyway, I would do #3. Hopefully this will give you some food for thought.

~~Bonnie

>Sorry, I'll explain again. I created a user control with 4 buttons. Each button has some logic in it. I placed the control on a form. From the form I can override the click events of each of the buttons. I want to know if there is a way to not call the click event on the user control when one of the buttons is clicked?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform