I have an aspx page with an asp.net button on the page:
<asp:LinkButton ID="btn_Delete" runat="server" OnClick="btn_Delete_Click" OnClientClick="ConfirmDelete();" Text="Delete" />
Confirm deletion is as follows:
function ConfirmDelete() { var answer = confirm("Are you SURE you want to delete this item?"); if (!answer) { return false; } };
I assumed that this would prevent the page from being published if the user clicks on cancel, but it still seems to be posting back. Is there a way to prevent sending with confirmation?
source share