Gridview - Pull value from one cell in one row

Discussion in 'ASP .Net Datagrid Control' started by pvong, Aug 5, 2007.

  1. pvong

    pvong Guest

    Hi, I'm a newbie and I'm looking for some help. I'm programming in
    VB.Net.

    I have a simple gridview and when the user hits the Edit link, the
    gridview changes to edit mode. I replaced the Textboxes with labels and I
    turn off the Update command because I want to write my own update command.
    I can not figure out how to pull the value from a cell in the row the user
    hit Edit on.

    Example: User hits edit on row 10 and the value I want to pull in in
    column 5 and is a Label with the ID of AnswerID. How do I get that value.
    This is what I've tried and it didn't work.

    Gridview.findcontrol("AnswerID").tostring


    Thanks!
    pvong, Aug 5, 2007
    #1
    1. Advertising

  2. pvong

    pvong Guest

    someone answered this at another group

    To get the content, use (VB.NET)
    CType(Gridview.Rows(GridView.EditIndex).Cells(5).FindControl("AnswerID"),Label).Text
    In C#:
    ((Label)Gridview.Rows(GridView.EditIndex).Cells(5).FindControl("AnswerID")).Text



    "pvong" <phillip*at*yahoo*dot*com> wrote in message
    news:%...
    > Hi, I'm a newbie and I'm looking for some help. I'm programming in
    > VB.Net.
    >
    > I have a simple gridview and when the user hits the Edit link, the
    > gridview changes to edit mode. I replaced the Textboxes with labels and I
    > turn off the Update command because I want to write my own update command.
    > I can not figure out how to pull the value from a cell in the row the user
    > hit Edit on.
    >
    > Example: User hits edit on row 10 and the value I want to pull in in
    > column 5 and is a Label with the ID of AnswerID. How do I get that value.
    > This is what I've tried and it didn't work.
    >
    > Gridview.findcontrol("AnswerID").tostring
    >
    >
    > Thanks!
    >
    >
    >
    >
    >
    pvong, Aug 6, 2007
    #2
    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. H5N1
    Replies:
    0
    Views:
    2,715
  2. Replies:
    2
    Views:
    2,157
    Mike Treseler
    Jun 28, 2006
  3. Replies:
    5
    Views:
    657
  4. pvong
    Replies:
    4
    Views:
    11,966
    pvong
    Aug 5, 2007
  5. Thomasa Gregg
    Replies:
    1
    Views:
    155
    Eliyahu Goldin
    Jun 9, 2004
Loading...

Share This Page