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

Get parent item from grid inside a nestedviewtemplate

2 Answers 27 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Felix
Top achievements
Rank 1
Felix asked on 08 Sep 2015, 03:11 PM

Hello,

 I have a datagrid1 which contains another datagrid2 inside a nestedviewtemplate. With datagrid2 I insert, update and delete records with the help of the different command events.

How is it possible to get the parent item inside the OnItemCommandEvent, if I click on "Add new record" or on the button inside my GridEditCommandColumn. I tried e.Item.OwnerTableView.ParentItem inside the OnItemCommand-event, but the ParentItem is always null. Thanks in advance.

Kind regards,
Felix

2 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 08 Sep 2015, 06:42 PM

Hello,

Please look into below link.

http://www.telerik.com/support/code-library/programmatic-creation-of-radgrid-hierarchy-with-templates

Above link will help you to how to find the parent grid because based on our structure some time we need to find "Parent" control before finding to ParentItem.

Let me know if any concern.

 

 

Thanks, 

Jayesh Goyani

0
Felix
Top achievements
Rank 1
answered on 09 Sep 2015, 07:13 AM

Hello Jayesh,

thanks for your answer. I was hoping that there is an easier way to get the id of the parent item of a nestedviewtemplate. But it seems I have to get a reference to the GridNestedViewItem to get the parent item.

Regards,
Felix

Tags
Grid
Asked by
Felix
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Felix
Top achievements
Rank 1
Share this question
or