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

Recommended Answers

All 3 Replies

Here's a simple Javascript function:

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

You can use it on your button like this:

onclick='confirmDelete()'

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

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

commented: yup it works i have added this in grid view delete button +0
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....
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.