This may seem like a silly question but I have not been working with ASP.NET for long and, but after reading several resources, I still cannot work this out.
I have a standard HTML Input button being run as a server control:
<input id="Button1" type="button" value="button" runat="server" onclick="if (!confirm('Do you wish to continue?')){return false;};" onserverclick="Button1_ServerClick" />
When the user clicks the button, using a Javascript confirm box it should ask them to confirm whether they wish to continue or not. This is fine, it is working. If the user Clicks Ok, then the onserverclick event handler is run, however if the user clicks Cancel, it should return false and the page should not PostBack and onserverclick should not run.
The problem is however that no matter which option the user clicks, the onserverclick event handler is still running also.
Can anyone shed some light onto this for me as I have a lot of validations that I need to perform at the client side before communicating with the server?
Cheers