7 Answers, 1 is accepted
0
Hello Marek,
Thank you for the proposal. The feature will be present in the SP1 of RadControls for WinForms in a couple of weeks.
If you have more ideas do not hesitate to share them with us.
Greetings,
Ray
the telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for the proposal. The feature will be present in the SP1 of RadControls for WinForms in a couple of weeks.
If you have more ideas do not hesitate to share them with us.
Greetings,
Ray
the telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Ian
Top achievements
Rank 1
answered on 29 Feb 2008, 04:46 AM
Hi
Has this feature been implemented yet? I can only see GetNodeByPath
Ian
Has this feature been implemented yet? I can only see GetNodeByPath
Ian
0
Hello Ian,
Thank you for writing.
This method was indeed implemented, but shortly after that it as replaced by the Find method of RadTreeNode Collection. This was done in order to provide better compatibility with the Windows Forms TreeView control.
Also, functionality allowing to execute arbitrary actions on a subtree of nodes in the form of commands has been added (the ExecuteBatchCommand and ExecuteScalarCommand static methods of RadTreeView). These methods can be used to search a subtree of nodes by executing a custom command for every node in that subtree.
This functionality is still relatively new, so any feedback will be greatly appreciated.
If you have any additional questions, please contact me.
Hope that helps.
Greetings,
Jordan
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for writing.
This method was indeed implemented, but shortly after that it as replaced by the Find method of RadTreeNode Collection. This was done in order to provide better compatibility with the Windows Forms TreeView control.
Also, functionality allowing to execute arbitrary actions on a subtree of nodes in the form of commands has been added (the ExecuteBatchCommand and ExecuteScalarCommand static methods of RadTreeView). These methods can be used to search a subtree of nodes by executing a custom command for every node in that subtree.
This functionality is still relatively new, so any feedback will be greatly appreciated.
If you have any additional questions, please contact me.
Hope that helps.
Greetings,
Jordan
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Ian
Top achievements
Rank 1
answered on 02 Mar 2008, 06:40 AM
Thanks for that
It would helpful if you could give a usage example on how to find a node by key. I am using the tag property of the nodes to store either a DataRow value or an array and I see the parameter for the value to search in Find is a string.
Also the two commands you describe look interesting but also would like an example of their use
Either VB or C#
Many thanks
Ian
It would helpful if you could give a usage example on how to find a node by key. I am using the tag property of the nodes to store either a DataRow value or an array and I see the parameter for the value to search in Find is a string.
Also the two commands you describe look interesting but also would like an example of their use
Either VB or C#
Many thanks
Ian
0
Hello Ian,
Thank you for writing back. Here are the details you requested:
Boyko Markov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for writing back. Here are the details you requested:
- We should set the Name property of RadTreeNode as it is used for comparison in the Find method:
private void SetNodesNames() { Stack<RadTreeNode> stack = new Stack<RadTreeNode>(); RadTreeNode node = null; int depth = 1; int i; for (i = this.radTreeView1.Nodes.Count - 1; i > -1; i--) { node = this.radTreeView1.Nodes[i]; if (node.Visible) { stack.Push(node); } } Stack<RadTreeNode> parentStack = new Stack<RadTreeNode>(); while (stack.Count > 0) { node = stack.Pop(); while (parentStack.Count > 0 && parentStack.Peek() != node.Parent) { parentStack.Pop(); depth--; } node.Name = node.Text; if ((node.Nodes.Count > 0)) { for (i = node.Nodes.Count - 1; i > -1; i--) { stack.Push(node.Nodes[i]); } parentStack.Push(node); depth++; } } }
- Then you can use the following syntax to search for a node:
RadTreeNode[] nodes = this.radTreeView1.Nodes.Find("Search Folders", true);
The "Search Folders" string represents the name of a node to search for. We set "true" to allow searching in the subtrees.
The ExecuteBatchCommand is used as follows:
Telerik.WinControls.UI.RadTreeView.ExecuteBatchCommand(this.radTreeView1.Nodes, -1, RadTreeNode.ExpandCollapseCommand, true);
There are a few default commands in RadTreeNode which you can use. If you would like you could create your own commands deriving the CommandBase class.
If you have any other questions please write us back.
Boyko Markov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Husam Al Madain
Top achievements
Rank 1
answered on 17 Mar 2011, 11:11 PM
the function find is not exist in q1 2011
radTreeView1.Nodes.Find("Search Folders", true);
how can i get the node by name
radTreeView1.Nodes.Find("Search Folders", true);
how can i get the node by name
0
Hi Husam Al Madain,
All the best,
Svett
the Telerik team
There is a breaking change regarding this method. You can use the following code snippet to find a node by key:
private
List<RadTreeNode> Find(
string
key,
bool
searchAllChildren, RadTreeNodeCollection treeNodeCollectionToLookIn)
{
List<RadTreeNode> list =
new
List<RadTreeNode>();
if
((treeNodeCollectionToLookIn ==
null
) || (list ==
null
))
{
return
null
;
}
for
(
int
i = 0; i < treeNodeCollectionToLookIn.Count; i++)
{
if
(treeNodeCollectionToLookIn[i] !=
null
)
{
if
(String.Compare(treeNodeCollectionToLookIn[i].Text, key,
true
) == 0)
{
list.Add(treeNodeCollectionToLookIn[i]);
}
if
(searchAllChildren && (treeNodeCollectionToLookIn[i].Nodes.Count > 0))
{
list.AddRange(
this
.Find(key, searchAllChildren, treeNodeCollectionToLookIn[i].Nodes));
}
}
}
return
list;
}
Svett
the Telerik team