This is a migrated thread and some comments may be shown as answers.

modifying grid nested view item server side ...

1 Answer 120 Views
Grid
This is a migrated thread and some comments may be shown as answers.
IT Services
Top achievements
Rank 1
IT Services asked on 08 Apr 2011, 07:59 PM
Let's use Grid / Hierarchy with templates demo as example and let's say that I want to add image on contact information tab for all users that are older than 30 on the server side in RadGrid1_ItemCreated event:
      protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
      {
         if (e.Item is GridNestedViewItem)
         {
            GridNestedViewItem gnvItem = (GridNestedViewItem)e.Item;
            e.Item.FindControl("InnerContainer").Visible = gnvItem.ParentItem.Expanded;
         }

How I would find the dob data to check if current item person is older than ... 30?

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 11 Apr 2011, 06:57 AM
Hello,

The following code snippet shows how to achieve this.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
   {
     if (e.Item is GridNestedViewItem)
      {
          GridNestedViewItem nestedItem = (GridNestedViewItem)e.Item;
          GridDataItem parentitem = (GridDataItem)nestedItem.ParentItem;//accessing parentItem
          string dob = parentitem["BirthDate"].Text;//getting birthdate using ColumnUniqueName
      }
   }

Thanks,
Princy.
Tags
Grid
Asked by
IT Services
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or