ASP.NET JavaScript Raising Click Event of a Button

By Mash B

This FAQ shows how to trigger the click of a button in an ASP.NET page.


You an raise the click event in pages not implementing a master page using the following JavaScript:

document.getElementById("Button1").click();

However, if you are using a master page, then you'll need to use the following syntax to deal with ASP.NET's dynamic control ids:

document.getElementById("<%=Button1.ClientID %>").click();

ASP.NET JavaScript Raising Click Event of a Button  (1459 Views)