Datakeyvalue

2 posts, 0 answers
  1. Tina
    Tina avatar
    130 posts
    Member since:
    Jul 2011

    Posted 24 Oct 2011 Link to this post

    Hello,

    I have an inner grid in nestedviewtemplate.how to access this value in itemdatabound of inner grid
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Oct 2011 Link to this post

    Hello Tina,

    Here is the sample code to access the DataKeyValue in ItemDataBound event.
    C#:
    protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
    {
      if (e.Item is GridDataItem)
      {
        RadGrid innergrid = (RadGrid)sender;
        GridNestedViewItem nesteditem = (GridNestedViewItem)innergrid.NamingContainer;
        GridDataItem parentItem = (GridDataItem)nesteditem.ParentItem;
        string Id = parentItem.GetDataKeyValue("ID").ToString();
      }
    }

    Thanks,
    Princy.
Back to Top