Retreiving a DataItem in the GridView's RowCommand

Discussion in 'ASP .Net Web Controls' started by Nathan Sokalski, Dec 14, 2007.

  1. I have a GridView with a ButtonField. In the RowCommand I need to use the
    value of one of the fields used in that row. I am having trouble doing this,
    so I would appreciate it if someone could help me here. Thanks.
    Nathan Sokalski, Dec 14, 2007
    #1
    1. Advertising

  2. Nathan Sokalski

    David Wier Guest

    What do you need to do with the value?

    if it's a databound Gridview, you would use the onRowDatabound event.
    Check out this sample:
    http://www.aspnet101.com/aspnet101/aspnet/codesample.aspx?code=gvConditionalDate

    David Wier
    http://aspnet101.com
    http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
    bloated markup


    "Nathan Sokalski" <> wrote in message
    news:...
    >I have a GridView with a ButtonField. In the RowCommand I need to use the
    >value of one of the fields used in that row. I am having trouble doing
    >this, so I would appreciate it if someone could help me here. Thanks.
    David Wier, Dec 14, 2007
    #2
    1. Advertising

  3. This is a ButtonField, and the reason I need the value is so that I know
    what SQL statement to execute on the database. The value is not being used
    for display, it is being used for functionality. The RowDataBound event will
    not help me here because I need to use the value in the RowCommand event, so
    I need a way to access the data from the current row.

    "David Wier" <> wrote in message
    news:...
    > What do you need to do with the value?
    >
    > if it's a databound Gridview, you would use the onRowDatabound event.
    > Check out this sample:
    > http://www.aspnet101.com/aspnet101/aspnet/codesample.aspx?code=gvConditionalDate
    >
    > David Wier
    > http://aspnet101.com
    > http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with
    > no bloated markup
    >
    >
    > "Nathan Sokalski" <> wrote in message
    > news:...
    >>I have a GridView with a ButtonField. In the RowCommand I need to use the
    >>value of one of the fields used in that row. I am having trouble doing
    >>this, so I would appreciate it if someone could help me here. Thanks.

    >
    >
    Nathan Sokalski, Dec 14, 2007
    #3
    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:
    0
    Views:
    5,814
  2. Zule
    Replies:
    1
    Views:
    5,332
  3. keithb
    Replies:
    1
    Views:
    4,299
    PeterKellner
    Jun 10, 2006
  4. Nathan Sokalski
    Replies:
    3
    Views:
    9,838
    Phil H
    Dec 15, 2007
  5. HeavyMetal

    GridView RowCommand problem: GridView Nested in Repeater

    HeavyMetal, Aug 8, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    784
    HeavyMetal
    Aug 8, 2006
Loading...

Share This Page