Groups | Blog | Home
all groups > vb.net data > july 2007 >

vb.net data : cant get data from not visible datagrid column


kpg
7/20/2007 12:52:25 PM
Hi all,

In asp.net 2.0 I'm having trouble getting data from a cell whose
column is marked as not visible

<asp:BoundField DataField="DataID" HeaderText="ID" ReadOnly="True"
Visible="false" />

Sub MyGridView_SelectedIndexChanged(ByVal sender As Object, ByVal e As
EventArgs)

Dim row As GridViewRow = MyGridView.SelectedRow
Message.Text = "You selected " & row.Cells(0).Text & "."

End Sub

but when row.cells(2).visible is false then row.cells(0).text = ""
even thought there is data there.


In asp.net 1.1 the syntax is somewhat different and I would do this:

<asp:BoundColumn Visible="False" DataField="DataID" ReadOnly="True"
HeaderText="ID">

dim item as DataGridItem = MyGridView.SelectedItem
Message.Text = "You selected " & item.Cells.Item(0).Text & "."

which works fine.


Any ideas?

TIA
kpg
7/20/2007 12:55:45 PM
kpg <no@spam.com> wrote in news:Xns9973975C1F36Eipostthereforeiam@
207.46.248.16:

<sigh> should read as:

[quoted text, click to view]
AddThis Social Bookmark Button