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

How to detect which item is binding in the grid

2 Answers 36 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Muhamed Shafi
Top achievements
Rank 1
Muhamed Shafi asked on 07 May 2011, 11:42 AM
Hi All,
    I have a grid in which a detailed subgrid is binding for each item using DetailTables. Now in the ItemDatabound event, I am not able to detect which item (main grid or sub grid)  is binding. Is there a way to detect this ? Any help would be appreciated.
Thanks in advance
By Shafi

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 07 May 2011, 01:50 PM
HI Muhamed Shafi,

if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
                if (item.OwnerTableView.Name == "ParentTable")
                 {
                         // do anything for parent table
                 }
                else if(item.OwnerTableView.Name == "ChildTable")
                {
                     // do anything child table
               }
}

<telerik:RadGrid>
    <MasterTableView Name="ParentTable">
    ...............
    ...............
 <DetailTables>
                            <telerik:GridTableView  Name="ChildTable" >
                                </telerik:GridTableView>
 </DetailTables>
...........
..................


Thanks,
Jayesh Goyani
0
Muhamed Shafi
Top achievements
Rank 1
answered on 09 May 2011, 06:43 AM
Hi Jayesh,
   Thanks a lot. Its working fine
Regards
Shafi
Tags
Grid
Asked by
Muhamed Shafi
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Muhamed Shafi
Top achievements
Rank 1
Share this question
or