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

Get number of nodes

3 Answers 116 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Giorgos
Top achievements
Rank 1
Giorgos asked on 17 Oct 2013, 11:34 AM
Is there any way to get the number of nodes an object of type RadDropDwonTree contains?

3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 21 Oct 2013, 10:47 AM
Hi Giorgos,

I guess you want to access the number of nodes in the RadDropDownTree. Please check the following JavaScript code.

JavaScript:
<script type="text/javascript">
    function getNodeCount() {
        var raddropdowntree = $find('<%=RadDropDownTree1.ClientID %>');
        alert("Count " + raddropdowntree.get_embeddedTree().get_allNodes().length);
    }
</script>

Thanks,
Shinu.
0
Sandeep
Top achievements
Rank 1
answered on 14 Mar 2016, 10:14 AM

Hello ,

I need same functionality to count the number of nodes in raddropdowntree from serverside.

I didnt get any option for it.

also can not set the value by selectedIndex

 

 

0
Nencho
Telerik team
answered on 16 Mar 2016, 09:49 AM
Hello Sandeep,

In order to get the Nodes count you can still use the Embedded TreeView control of the DropDownTree, but at server-side. In addition, regarding the SelectedIndex that you need to set - you can access the NodesCollection (index-based) of the Embedded TreeView and use the SyncEmbeddedTree method.

In the attachment you can find a simple example demonstrating the above suggested approaches.

Hope this would help.

Regards,
Nencho
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
DropDownTree
Asked by
Giorgos
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Sandeep
Top achievements
Rank 1
Nencho
Telerik team
Share this question
or