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 (header column name is "description") and not sure how to do this. Here is the code I have:
Get error (last line of code): Object reference not set to an instance of an object.Code:Dim index = Convert.ToInt32(e.CommandArgument) Dim mySelectedRow As GridViewRow = GridView1.Rows(index) Dim myButtonField As LinkButton = mySelectedRow.FindControl("description") Dim jobtext As String = myButtonField.Text.ToString
Can somebody help please. Thank you.




Reply With Quote