You have to command argument to the button
Pls find the example
Code:
Protected Sub GridView2_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView2.RowCommand
Dim gvr As GridViewRow = GridView1.Rows(e.CommandArgument)
TextBox1.Text = gvr.Cells(0).Text 'The index of the column
End Sub
Protected Sub GridView2_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView2.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim btn As Button = e.Row.FindControl("btnSel")
If Not btn Is Nothing Then
btn.CommandArgument = e.Row.DataItemIndex 'set the Index as command argument
End If
End If
End Sub