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

Q1 2011 - Equivalent to ExpandLevel

4 Answers 61 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
MNP
Top achievements
Rank 1
MNP asked on 25 Mar 2011, 10:32 PM
Updated to Q1 2011 and noticed the ExpandLevel call didn't make it over to the new TreeView. Is there an equivalent, or do I have to write a loop to manually do it?

If so, can I request the ability to do this come back? 

Thanks

-Matt

4 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 30 Mar 2011, 03:59 PM
Hello Matt,

Thank you for writing.

You can use the Expand function and provide as an argument the desired tree node collection which you want to be expanded. For the inner levels you will have to loop through the nodes.

I hope this helps.
 
Best wishes,
Stefan
the Telerik team
0
Ian
Top achievements
Rank 1
answered on 30 Mar 2011, 08:16 PM
Hi Matt

I recently needed to achieve node expansion in a way which allowed me to restrct the level in the tree to which expansion would occur. This code works quite nicely:

private void TreeNodeRecursiveExpansion(RadTreeNodeCollection nodes, int level)
{
        foreach (RadTreeNode myNode in nodes)
        {
            if (myNode.Level != level)
            {
                myNode.Expand();
                TreeNodeRecursiveExpansion(myNode.Nodes, level);
            }
        }
}


Regards
Ian Carson
0
Stefan
Telerik team
answered on 04 Apr 2011, 04:21 PM
Hello Ian,

Thank you for sharing your code with the community.
 
Best wishes,
Stefan
the Telerik team
0
Ian
Top achievements
Rank 1
answered on 05 Apr 2011, 05:36 AM
Hi Stefan

That's my pleasure. You guys are very helpful so just trying to give back a little as well.

Regards
Ian
Tags
Treeview
Asked by
MNP
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Ian
Top achievements
Rank 1
Share this question
or