How do you run a script a开发者_C百科s the updatepanel begins. I have a gridview inside an updatepanel and when the user clicks to sort or to change page, I'd like to run a script just as the postback begins.
Thanks.
You can use the beginRequest event handler. You can see the documentatio here. If you have more than one update panel with update mode Conditional you will need to inspect the request to see which update panel is being updated.
If you want to run a script on the client before postback, you could add a "OnClick" handler (client side, so OnClientClick for a server side control) and do whatever you want in there. The form won't post back until that script is finished and returns true.
精彩评论