Why/How
It can be useful to be able to call a JavaScript function after an ASP.NET event has completed, but it is not immediately intuitive how this can be done.
Adding an onClientClick event to an ASP.NET button control will execute the JavaScript call before the ASP.NET server side code executes, so an alternate solution is required.
For example today I was working on a WebForms page that has a Gridview presenting data, and that displays a detailed form page for each row in the GridView in an IFrame when one of the GridView rows is clicked. I use a FormView to handle the detailed form page information.
After editing the data contained in the detailed form page, a user can click the save button at which point the FormView’s ASP.NET Update event is triggered, and then subsequently the button’s click event fires.
