GridView: DataKeys not available in RowDataBound!

Discussion in 'ASP .Net' started by Benton, Dec 19, 2006.

  1. Benton

    Benton Guest

    Hi there,

    I have a GridView with DataKeyNames="SID" on the markup.

    To me surprise, I can get this value just fine in the RowDeleting and
    RowEditing events, for instance:

    string pk = gv.DataKeys[e.NewEditIndex].Value.ToString();

    However in the RowDataBound event, the DataKeys[] array is empty.

    Is this normal or am I doing something wrong?

    Thanks in advance,

    -Benton
    Benton, Dec 19, 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. =?Utf-8?B?TGluZ28=?=

    Gridview asp.net 2.0 datakeys not loading

    =?Utf-8?B?TGluZ28=?=, Oct 31, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    593
    =?Utf-8?B?TGluZ28=?=
    Oct 31, 2005
  2. =?Utf-8?B?ZGFuYw==?=

    GridView RowDataBound not called after postback

    =?Utf-8?B?ZGFuYw==?=, Feb 17, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    7,587
    amiguyus
    Dec 14, 2010
  3. K B
    Replies:
    2
    Views:
    5,128
    Jan Hyde
    Jun 1, 2006
  4. =?Utf-8?B?UmljayBEcm9za2U=?=

    Gridview DataKeys property not set when PageIndexChanged fires

    =?Utf-8?B?UmljayBEcm9za2U=?=, Dec 13, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    382
    =?Utf-8?B?UmljayBEcm9za2U=?=
    Dec 13, 2006
  5. sevilsivle

    GridView.DataKeys appear not to be filled

    sevilsivle, May 2, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    132
    sevilsivle
    May 2, 2006
Loading...

Share This Page