Skip to content

Instantly share code, notes, and snippets.

@code-atom
Created September 12, 2017 05:09
Show Gist options
  • Save code-atom/32c9012294900cadb17730b89cc90a84 to your computer and use it in GitHub Desktop.
Save code-atom/32c9012294900cadb17730b89cc90a84 to your computer and use it in GitHub Desktop.
Disable the button after the first click and submit the form in asp.net.
<asp:Button ID="btnSubmit"
ValidationGroup="confirmOrder"
OnClientClick="submitOrder()"
OnClick="SubmitOrder"
Text="Pay Now"
CssClass="inputSubmit" runat="server"
UseSubmitBehavior="false"
/>
<script type="text/script">
function submitOrder() {
var isValid = false;
isValid = Page_ClientValidate('confirmOrder');
if(isValid) {
document.getElementById('btnSubmit').disabled = true;
}
return isValid;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment