I have an extender control that raises a textbox’s OnTextChanged event 500ms after the user has finished typing. The problem with this is that OnTextChanged gets raised when the textbox loses focus, which causes problems (because of the postback).
What I’d like to do is give the extender control its own server-side event (say, OnDelayedSubmit) so I can handle it separately. The event will originate in the extender control’s behavior script (after the 500ms delay), so putting a __doPostBack in onchanged is not an option.
Can anyone shed light on how to go about this?
After plenty of reading up on extender controls and JavaScript, I’ve cobbled together a solution that seems to be working so far.
The main trick was getting the necessary postback code from server-side to the client-side behavior script. I did this by using an
ExtenderControlProperty(which is set in the control’sOnPreRenderfunction), and then eval’d in the behavior script. The rest was basic event-handling stuff.So now my extender control’s
.csfile looks something like this:And my behavior script looks something like this:
Now the server-side event can be handled the same way you’d handle an event on any other control.