- About us
1. Here we have a function The 'ConfirmDelete()' which is executed each time a click event occurs on the page.
2. Then we use a logic that to find which element was clicked on i.s we append a word 'DELETE' to the ID of the control.
var e = window.event;
targ = (e.target) ? e.target : e.srcElement;
if (targ.nodeType == 3)
targ = targ.parentNode;
if (targ.id.toLowerCase().indexOf("delete") >= 0)
return confirm("Do you want to delete this item?");
document.onclick = ConfirmDelete;
<asp:GridView RunAt="server" ID="gvTest" DataSourceID="SqlDataSource1">
ID="DeleteMe" Text="Delete" />