Jump to content

SelectedRow - GridView


madsovenielsen

Recommended Posts

HelloI have some data in a Gridview, selection is enabled, i need to be able to select a row and get the content of the first cell from that row. Here is the code:

	Public Sub codeGridView_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles GridView1.RowCommand		Dim row As GridViewRow = GridView1.SelectedRow		Response.Write(row.Cells(1).Text)	End Sub

I have this property set in the GridView control:

onselectedindexchanged="codeGridView_SelectedIndexChanged"

There is no errors in the IDE but when i try to select a row the browser quits and i get this error in the IDE:

NullReferenceException was unhandled by user code.Object reference not set to an instance of an object.

Whats wrong ?Any help is greatly appreciated.Kind regards Mads Nielsen

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...