I have a basic asp.net submit button like so:
<asp:Button ID="test" runat="server" onclick="test_Click" />
I have a javascript method that I want to run before submitting, but I cannot set it up to do so. Anyone know how? The javascript method returns true/false at the end where true = submit.
Thanks for the replies, but I have already tried what you said and it didn’t work. Here is my markup:
<asp:Button OnClientClick="return checkInput();" ID="test" runat="server" onclick="test_Click" />
The javascript method runs, but even when it returns true the page doesn’t post back.
Edit: Nevermind, there was something wrong with the javascript method.
You need to define OnClientClick property for that.
replace the javascript with whatever you want to do, but the above example will only trigger your behind code sub/function [
test_Click] only after the user clicks YES in the confirm dialog box