Stopping onclick from firing when onclientclick is false?

You want to add return inside OnClientClick after a function is called. Otherwise, the button will post back even if function returns false. <asp:button ID=”Button1″ runat=”server” OnClick=”Button1_Click” OnClientClick=”return checkValidation()” Text=”Submit” /> <script type=”text/javascript”> function checkValidation() { return confirm(‘Everything ok?’); } </script>

OnclientClick and OnClick is not working at the same time?

From this article on web.archive.org : The trick is to use the OnClientClick and UseSubmitBehavior properties of the button control. There are other methods, involving code on the server side to add attributes, but I think the simplicity of doing it this way is much more attractive: <asp:Button runat=”server” ID=”BtnSubmit” OnClientClick=”this.disabled = true; this.value=”Submitting…”;” UseSubmitBehavior=”false” … Read more