Ah, Brilliant! Thank you, Imar!
I changed it just a bit, to account for the fact that the control changes from a "Delete" button to a "Cancel" button depending on what mode the row is in. Here's the full code:
Protected Sub AddDeleteConfirmation(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles gvSearchResults.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim lb As LinkButton
lb = e.Row.Cells(0).Controls(2)
If lb.Text = "Delete" Then
lb.Attributes.Add("onclick", "javascript:return confirm('Are you sure you want to delete this row?');")
End If
End If
End Sub
|