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 Answers
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 Comment
Iti Tyagi
I am using the same but this is not opening the page in new tab(as my client side script opens a new tab), when I am calling same function from server side.
OnClickbeing a postback that results in a new page, and theOnClientClickbeing 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.