Hi,
I think you should handle this in RowCommand event.
You may try this:
Protected Sub grdDeptEmp_RowCommand(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles grdDeptEmp.RowCommand
If e.CommandName = "DeleteCmd" Then
Dim rowNo As Integer = Integer.Parse(e.CommandArgument)
Dim EmpNo As String = grdResult.DataKeys(rowNo).Item("emp_number").ToString.Trim
Conn.Open()
StrQry = ""
StrQry = "delete from OtherDeptEmp where emp_number='" & EmpNo & "'"
Cmd.Connection = Conn
Cmd.CommandText = StrQry
'Cmd.ExecuteNonQuery()
Conn.Close()
End If
FillGrid()
End Sub
In your client code Grid example:
<asp:ButtonField CommandName="DeleteCmd" Text="Delete"/>
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Regards,
Algem