How to get the DataKeyField in the DataGrid ?

Discussion in 'ASP .Net Datagrid Control' started by Kylin, May 31, 2005.

  1. Kylin

    Kylin Guest

    I set the DataKeyField in a DataGrid ,
    and an EditCommand ,
    when I click the EditCommand ,
    I want to get the row's DataKeyField ,
    and redirect to other page like this Item.aspx?id=XXX
    the XXX jut equal the DataKeyField 's value ?

    how can I do this ?
    and I have a long tiem to try it ,
    but Not OK!


    --
    FireCrow Studio
    Kylin Garden
    QQ:462042991
    MSN:
    ICQ:156134382
    Kylin, May 31, 2005
    #1
    1. Advertising

  2. Kylin

    Brock Allen Guest

    If you have the DataGridItem's ItemIndex, then you can index into the DataGrid's
    DataKeys collection. The DataGridItem is available in the EditCommand via
    the DataGridCommandEventArgs parameter.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > I set the DataKeyField in a DataGrid ,
    > and an EditCommand ,
    > when I click the EditCommand ,
    > I want to get the row's DataKeyField ,
    > and redirect to other page like this Item.aspx?id=XXX
    > the XXX jut equal the DataKeyField 's value ?
    > how can I do this ?
    > and I have a long tiem to try it ,
    > but Not OK!
    Brock Allen, May 31, 2005
    #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. Homer J. Simpson
    Replies:
    2
    Views:
    1,100
    Suresh
    Mar 5, 2004
  2. Adam Knight

    DataGrid - DataKeyField!!

    Adam Knight, Aug 7, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    4,176
    Adam Knight
    Aug 7, 2005
  3. Sean

    how to get datagrid item index from DataKeyField value?

    Sean, Aug 6, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    750
    Arthur
    Aug 7, 2003
  4. A. Atienza

    DataGrid's DataKeyField Value (C#)

    A. Atienza, Dec 7, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    330
    Michael Tkachev
    Dec 7, 2004
  5. Stephen Woolhead

    Datagrid DataKeyField and Webservice Proxy Objects

    Stephen Woolhead, Dec 16, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    151
    Stephen Woolhead
    Dec 20, 2004
Loading...

Share This Page