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

Working with Treeview child node - get a selected item

1 Answer 104 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 08 Apr 2014, 08:14 PM
How to get a selected item of a child treeview programmatically 

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 09 Apr 2014, 09:07 AM
Hi Charles,

You can get the selected item of a RadTreeView with its SelectedItem property.

However, you can keep in mind that the containers of the children of a RadTreeView are generated when they are expanded for the first time. If the selected item is in lower level in the tree hierarchy and has not been expanded yet, the SelectedItem property will return Null. This is caused by the fact that the selected RadTreeViewItem is not generated.

In order to get a selected item which has not been expanded yet (therefore is not generated) you can use the GetItemByPath() method. For your convenience I attached a sample project which demonstrates the use of this method.

Please let me know if you need any further assistance.

Regards,
Martin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TreeView
Asked by
Charles
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or