GridView.Cells

Discussion in 'ASP .Net' started by Dot Net Daddy, Aug 4, 2006.

  1. 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
    Dot Net Daddy, Aug 4, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    4,558
  2. Edwin Knoppert

    Gridview's findcontrol ignores cells()

    Edwin Knoppert, Nov 25, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,542
    Edwin Knoppert
    Nov 25, 2005
  3. Krish

    GridView Empty Cells

    Krish, Jan 11, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    2,707
    Krish
    Jan 11, 2006
  4. Replies:
    0
    Views:
    511
  5. Joel Finkel

    Cells[].Text or Cells[].Controls[0]

    Joel Finkel, Sep 1, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    294
    Joel Finkel
    Sep 1, 2003
Loading...

Share This Page