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

Hierarchial radgrid

1 Answer 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dheeraj
Top achievements
Rank 1
Dheeraj asked on 13 Apr 2014, 01:36 PM
In hierarchial radgrid how to get the parent row index from child row in Item_created  method.

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 14 Apr 2014, 04:30 AM
Hi Dheeraj,

You can try the following code snippet to access the parent index from the child table.

C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "DetailTableName")
    {         
        GridDataItem childItem = e.Item as GridDataItem;
        int childIndex = childItem.ItemIndex;//Detail table index
        GridDataItem parentItem =(e.Item.OwnerTableView.ParentItem) as GridDataItem;
        int parentIndex = parentItem.ItemIndex;//Parent table index  
    }
}

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