I have a gridview that gets data from an objectdatasource. the grid has a commandfield in which i show both the edit and delete buttons.
i have figured out how to confirm the delete...
If e.Row.RowType = DataControlRowType.DataRow Then
Dim cmdDel As Button
cmdDel = e.Row.Cells(0).Controls(2)
cmdDel.Attributes.Add("onclick", "if(!confirm('Are you sure you want to delete this row?')) {alert(""The record was not deleted.""); return false;}")
End If
This works great. The problem is... when i click on the edit button and then cancel out of it, i get the alert confirming a delete.
Any ideas how to confirm the delete but make it not come up on the edit cancel?
Thanks in advance
G