I am puzzled why this return false doesn’t cancel the post-back.
function validate() {
return false;
}
<asp:Button ID="Button1" type="submit" OnClientClick="validate();" runat="server" Text="send" />
The most crazy part is that the code below DOES cancel the postback, but I need this to happen in the function like above:
<asp:Button ID="Button1" type="submit" OnClientClick="return false;" runat="server" Text="send" style="margin-right:150px;" />
Try returning the value from your function, like this
Otherwise you are just executing a javascript function that returns a boolean.