GridView.Cells

D

Dot Net Daddy

Hello,

I set one of the columns in the GridView to visible=false. But I want
show the value in that column for the selected row, in a Label.

I tried this one, but it didnt work:

Protected Sub GridView1_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
GridView1.SelectedIndexChanged
Label3.Text = GridView1.SelectedRow.Cells(3).Text
End Sub

Nothing shows even though the column has data. Then I tried the
following one:

Protected Sub GridView1_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
GridView1.SelectedIndexChanged
GridView1.Columns(3).Visible = True
Label3.Text = GridView1.SelectedRow.Cells(3).Text
GridView1.Columns(3).Visible = False
End Sub


But it didn't work either. I think it is because the Page_Load sub
function is run last.

Can you please give any idea how to solve this problem.

Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top