Skip to content
Advertisement

Confirmation delete window – deleting record when click delete or cancel

I have a Javascript file that contains the function for calling the confirmation delete window, the code used is similar to the following:

JavaScript

I have a gridview with a template field that can delete a row in the gridview, this is a snippet of what I have:

JavaScript

Within the aspx.vb page I have code to do the deletion of the record (this works fine), I have this code within the gridview property OnRowDeleting="RowDeleting1"

JavaScript

When the confirmation of the delete appears (options are to delete or cancel), the deletion occurs when I click delete or cancel. Ideally I only want the deletion to occur when I click delete and just stay on the page when I click cancel, would anyone be able to advise what I am doing wrong?

Advertisement

Answer

Replace confirm('Delete this user'); with return confirm('Delete this user');

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement