I have a gridview and I am able to get cell values for bound fields like this:
Code:
If e.CommandName = "description" Then
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim mySelectedRow As GridViewRow
mySelectedRow = GridView1.Rows(index)
Dim mySelectedCell As TableCell
mySelectedCell = mySelectedRow.Cells(3)
Dim jobtext As String
jobtext = mySelectedCell.Text
End If
Now I need to get the value for a Button Field and not sure how to do this. Here is the code I have:
Code:
Dim index = Convert.ToInt32(e.CommandArgument)
Dim mySelectedRow As GridViewRow = GridView1.Rows(index)
Dim myButtonField As LinkButton = mySelectedRow.FindControl("descrption")
Dim jobtext As String = myButtonField.Text.ToString
Get error (on last line in code): Object reference not set to an instance of an object.
Can somebody help please. Thank you.