I have a asp.net button
I want to run a JavaScript function animation() along with the asp.net function Button1_Click when the user clicks on submit.
i have written the following code for the same but unable to get the desired result
protected void Button1_Click(object sender, EventArgs e)
{
Button1.Attributes.Add("onClick", "animation()");
<Some Code Here>
}
OnClientClickto have your ASP.NET button run a JavaScript method before calling its server-side method.OnClickspecifies the server side method to run.Button1.Attributes.Add("onClick", "javascript:animation()");