Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Selectively firing events
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01147981
Message ID:
01148111
Views:
20
I don't think this can be done because AutoPostBack originates on the client. You'd have to disconnect the client handler. Something like:
document.getElementById('MyListBox').onchange = MyFunction() {};
Not sure if that would work but I think that's what needs to happen.

The other alternative is to only hook up the event handler selectively when you know you don't want to fire the event. In that case you can just set AutoPostback to false.

+++ Rick ---

>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.

Can't you just set AutoPostBack to false in the code that decides not to post?
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform