Below is part of my code to do the delete record command:-
Private Sub Delete(ByVal Source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.DeleteCommand
Dim strScript As String = ""
Dim strLocationID As String = e.Item.Cells(2).Text
[COLOR=Red] If txtbox.Text = "Yes" Then
'Do a lot of coding here and call function
' Do nothing