I am currently working on an aspx page that contains an asp.net button. The code for the button is shown below:
<asp:LinkButton ID="btn_Delete" runat="server" OnClick="btn_Delete_Click" OnClientClick="ConfirmDelete();" Text="Delete" />
The Confirm delete function is as follows:
function ConfirmDelete() {
var answer = confirm("Are you SURE you want to delete this item?");
if (!answer) {
return false;
}
};
I originally thought that clicking cancel would prevent the page from posting back, but it still seems to be posting back. Is there a way to prevent postback using the confirm function?