1
votes

Is it possible to fire the onclientclick after the onclick event for asp.net button? I am sending some values in session from onclick event and then I want to fire onclientclick. Any help would be advisable.

2
I believe that can not be happen. But you can use ajax. On client click go to server and write things to session. - kostas ch.
I mean that can not be happen as you said it, without a trick. - kostas ch.
It's highly unlikely that this is possible due to the OnClick being a postback that results in a new page, and the OnClientClick being a client side script function. Clearly the script of this page will happen before the result of the postback provides the new page, otherwise the script is no longer there. - Bazzz

2 Answers

2
votes

You can call the javascript function using register client script inside the onclick of the button.

    ClientScript.RegisterStartupScript(Page.GetType, "Javascript", 
"YourButton_OnClientClick_Handler();", true);
1
votes

Are you using an Update Panel? If yes, capture the endrequest and write code there..

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest);