I can get this to work on every edit button but I only want it to execute on the RowUpdating for the gridview. I tried putting the call to the function in the RowUpdating but then it won't execute.
I would think that this needs to be called in the RowUpdating since I only want the alert to display after a user clicks update. This is the code that I had for the function when I had it in the RowUpdating:
Public Shared Sub UpdateCommand(ByRef gv As GridView, Byval e as GridViewUpdateEventArgs)
If gv.SelectedRow.RowType = DataControlRowType.DataRow Then
For Each dcf As DataControlField in gv.Columns
if dcf.ToString = "CommandField" Then
If CTYPE(dcf, CommandField).ShowEditButton = True Then
gv.Rows.Item(gv.Columns.IndexOf(dcf).Attributes.Add("onclick", return confirm('alert message')")
End if
end if
Next
end if
End sub