Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Selectively firing events
Message
From
23/08/2006 16:08:34
Keith Payne
Technical Marketing Solutions
Florida, United States
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01147981
Message ID:
01148010
Views:
15
>Hopefully I can explain this...
>
>I've got a user control that has a dropdown list on it. It calls an object which retrieves some data that I then use to populate the dropdown with.
>
>I can see a need to be able to raise an event when the user changes the combo (e.g. the default SelectedIndexChanged event of the dropdown). I don't want a postback to happen if no one is listening for this event (that is, in my user control if I were to just bind to SelectedIndexChanged and raise my own event, a postback will occur each time an item is changed even if the page it was hosted on didn't care about the event). I am trying to avoid this postback if it's not necessary.
>
>I thought about just adding a boolean property that basically says, "Raise this event" but that feels kind of like a hack. However, I don't really see any other way of doing this automatically.
>
>Any ideas?

Paul,

I see in the help that web controls have an Events property (inherited from Control) that will return an EventHandlerList. I don't see anything in the EventHandlerList that would tell you the number of events, but perhaps it is a place to start looking.
Previous
Reply
Map
View

Click here to load this message in the networking platform