Hi,
I am having a tree view in which there is no limit for adding the child's level (may be between 20-25) .But i could not find a recursive method which can recursively expand a particular child node (which is the result of the search i am providing).Please help.
Thanks & Regards,
Sagar
I am having a tree view in which there is no limit for adding the child's level (may be between 20-25) .But i could not find a recursive method which can recursively expand a particular child node (which is the result of the search i am providing).Please help.
Thanks & Regards,
Sagar
7 Answers, 1 is accepted
0

Richard Slade
Top achievements
Rank 2
answered on 02 Dec 2010, 06:30 PM
Hello Sagar,
This will expand all nodes for you. Or colapse them
hope that helps
Richard
This will expand all nodes for you. Or colapse them
For
Each
node
As
Telerik.WinControls.UI.RadTreeNode
In
Me
.RadTreeView1.Nodes
node.ExpandAll()
'node.CollapseAll()
Next
hope that helps
Richard
0

Sagar
Top achievements
Rank 1
answered on 03 Dec 2010, 05:56 AM
Hi, Richard,
Thanks, but i want to expand a particular node and the parents of the particular Node (node may be End Node or middle One)..
Thanks & Regards,
Sagar
Thanks, but i want to expand a particular node and the parents of the particular Node (node may be End Node or middle One)..
Thanks & Regards,
Sagar
0

Sagar
Top achievements
Rank 1
answered on 03 Dec 2010, 06:24 AM
In Rad Asp.net controls we get the one line to expand all the parent nodes.
i.e:
node.expandparentnode=true;
But what is there equivalent to it in WinForms..
i.e:
node.expandparentnode=true;
But what is there equivalent to it in WinForms..
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 03 Dec 2010, 08:13 AM
Hello Sagar,
As far as I know there is no equivilent is WinForms. You would have to loop over the nodes calling the Expand methid on each one.
If yu want to do this recursively with some conditions attached, have a look at this code library article on searching a tree view which shows how to drill down through a tree view. This can easily be updated to expand or collspase particular nodes under a given condition.
Hope that helps but let me know if you have any other questions
Richard
As far as I know there is no equivilent is WinForms. You would have to loop over the nodes calling the Expand methid on each one.
If yu want to do this recursively with some conditions attached, have a look at this code library article on searching a tree view which shows how to drill down through a tree view. This can easily be updated to expand or collspase particular nodes under a given condition.
Hope that helps but let me know if you have any other questions
Richard
0

Sagar
Top achievements
Rank 1
answered on 07 Dec 2010, 10:09 AM
Hi, Richard .
i got time today to come back on this topic. And it clicked to me after some time. Anyways your post gave me some "IDEA".
Thanks & Regards,
Sagar
i got time today to come back on this topic. And it clicked to me after some time. Anyways your post gave me some "IDEA".
Thanks & Regards,
Sagar
0

Richard Slade
Top achievements
Rank 2
answered on 07 Dec 2010, 10:11 AM
Glad that helped.
Richard
Richard
0
Hello Sagar,
the Telerik team
You can use the following code snippet to achieve this behavior:
private
void
ExpandParents(RadTreeNode childNode)
{
Stack<RadTreeNode> nodeStack =
new
Stack<RadTreeNode>();
nodeStack.Push(childNode.Parent);
while
(nodeStack.Count > 0)
{
RadTreeNode current = nodeStack.Pop();
if
(current ==
null
)
{
break
;
}
current.Expand();
nodeStack.Push(current.Parent);
}
}
I hope this helps.
Regards,
the Telerik team