What is the best way to determine which ASP.NET button was clicked on a single page using JavaScript?
Add a client-side onclick handler to each button pointing to the same function?
e.g.
<button onclick="myHandler(this.ID)" />
I just the set the OnClientClick event handler for the button with the JavaScript function I wanted executed when the button was clicked during the Page_Load event.
protected void Page_Load(object sender, EventsArgs e)
{
MyButton.OnClientClick = "MyJavaScriptMethod();";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With