Is it possible to make a single button run a client side script and run a server side function? If so how? Thanks.
Printable View
Is it possible to make a single button run a client side script and run a server side function? If so how? Thanks.
Add a server side control, then at the Page_Load for your page, add a property to the button for name=onClick and parameter="Your function"
The compiler will add it and then add its own definition for the click handler too. If your client function returns a true value, the post back occurs and the server side executes.
If your client code returns false, execution halts and the button does not post back.
Also possible if you do this in page load:
Button1.Attributes.Add("onClick", "functionCall();");