M
mosscliffe
I have a gridview and in the GridView1_SelectedIndexChanged routine I
am attempting to get at the data in the row
I have done it successfully with cells
'Access the contents of a field in a GRIDVIEW
Dim joe As String = GridView1.SelectedRow.Cells(1).Text
lbxDebug.Items.Insert(0, joe)
but I thought I would try to access the data via the 'FieldName'
so I tried
Dim gvr As GridViewRow = GridView1.SelectedRow
Dim fred As TextBox = gvr.FindControl("Title")
lbxDebug.Items.Insert(0, fred.Text) but it errors with the
reference to fred.text in executing, not in compiling
Error: Object reference not set to an instance of an object.
Please help, I thought I had got this cracked.
am attempting to get at the data in the row
I have done it successfully with cells
'Access the contents of a field in a GRIDVIEW
Dim joe As String = GridView1.SelectedRow.Cells(1).Text
lbxDebug.Items.Insert(0, joe)
but I thought I would try to access the data via the 'FieldName'
so I tried
Dim gvr As GridViewRow = GridView1.SelectedRow
Dim fred As TextBox = gvr.FindControl("Title")
lbxDebug.Items.Insert(0, fred.Text) but it errors with the
reference to fred.text in executing, not in compiling
Error: Object reference not set to an instance of an object.
Please help, I thought I had got this cracked.