I am using a RadTreeView & the tree menu is data sourced. On the server side when I try to grab the nodes using
foreach (RadTreeNode node in RadTreeView1.Nodes)
This provides only the root nodes (the ones at the higher level). All of the nodes have quite few child node & subfolders (which again contain child nodes). How can I scroll thru all the nodes in the tree?
Thank you
8 Answers, 1 is accepted
The experienced behavior is the default one since the Nodes collection of the RadTreeView is only giving the root nodes.
Please try the GetAllNodes method of the RadTreeView, which returns a linear list of all nodes.
Greetings,
Dimitar Terziev
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
I am trying to attach the context menu at each node dynamically.
I am not using "GetAllNodes" but was able to get the nodes for each root node as below & calling this routine recursively.
foreach (RadTreeNode n in nodes)
The problem is when I am trying to set the ContextMenu option for the child nodes. It doesnt provide the method to set the ContextMenu on child nodes. Not sure if "GetAllNodes" makes any difference there.
Can you please provide example how can I attach the context menu to child nodes for each root node. Below is the code I am currently trying & is not working. I didnt find any method which allows to set "ContectMenu" option, once inside the root node, at child node level.
Thank you
Please refer to the following help article showing how to add context menus dynamically.
Kind regards,
Dimitar Terziev
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
I need get all child nodes but in javacript, how can i do it?
Thanks
You can try the following to find the child nodes of each parent node. Here I tried in the NodeDoubleClick event.
JS:
<script type=
"text/javascript"
>
function
ClientClick(sender,args)
{
var
i;
for
(i=0;i<sender.get_nodes().get_count();i++)
{
var
item = sender.get_nodes().getItem(i);
if
(item.get_level() == 0)
{
// same logic to find the child of this parent
}
}
}
</script>
Thanks,
Princy.
Thanks for your reply your code helped me a lot :D
But now i have other problem, i need to know if a node have child is possible in js?
Thanks
You can try the following javascript.
JS:
var
item = sender.get_selectedNode();
if
(item._hasChildren()==
true
)
{
//your code
}
Thanks,
Princy.
i want to maintain the RadTreeView data during postbacks in a javascript.and i gave expandmode=3(webservice) to get a child nodes for the corresponding nodes.