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

Nested View Template Relationships

1 Answer 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 24 Nov 2010, 02:27 PM
Hi,

I have a three tier datagrid Hierarchy which basically consists of a Radgrid, in the Radgrid i have specified a master table and a detail table.  Within the detail table i have also specified a nested view template which holds another radgrid.  The set up works fine as everything expands as it should.

However, while selecting an item in the 3rd level of the hierarchy i would like to obtain a reference to the item expanded in the first level.
at present i am trying to perform this operation like so 

e.Item.OwnerTableView.ParentItem.GetDataKeyValue("EnquiryNo");
 The event isn't important, but e is of type GridSortCommandEventArgs.

The problem with this is that ParentItem is null.

This technique has worked in the same project when trying to get a handle from the detail table to the master table which leaves me to believe that a relationship must be set up between the nested view template and the detail table.

Any help will be greatly appreciated thank you

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 25 Nov 2010, 07:29 AM
Hello Michael,

Try the following code snippet to get the DataKeyValue of item in MasterTable(first level).

C#:
protected void RadGrid2_SortCommand(object source, GridSortCommandEventArgs e)
   {
       RadGrid RadGrid2 = (RadGrid)source; // grid inside NestedViewTemplate
       GridNestedViewItem item = (GridNestedViewItem)RadGrid2.NamingContainer;
       item.ParentItem.OwnerTableView.ParentItem.GetDataKeyValue("EnquiryNo");
   }

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