0

HI EVERY ONE

how i can insert a confirm dialog box behind delete record button so that it will prompt like this

ARE YOU SURE YOU WANT TO DELETE?
YES OR NO ?

if yes button is pressed then it will delete other wise dont .?
thanks in advance

3
Contributors
3
Replies
5
Views
5 Years
Discussion Span
Last Post by chunkbar
1

Here's a simple Javascript function:

function confirmDelete() {
    return confirm('Remove this item?');
}

You can use it on your button like this:

onclick='confirmDelete()'
1

You can use below code for ADD CONFIRM DELETE DIALOG BOX solution

OnClientClick="return confirm('Are you sure you want to delete this ProductType?');"

Votes + Comments
yup it works i have added this in grid view delete button
1
thanx all
i wrote this in page_load func

if(!IsPostBack)
 {
 DeleteUserBtn.Attributes.Add("onclick", "return confirm('Are you sure
 you want to Delete?')");
 }

 i tried this and it works....
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.