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

how to expand nodes by level

0 Answers 176 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
moegal
Top achievements
Rank 1
moegal asked on 06 Oct 2012, 12:09 AM
Hi,
I have a 3 level tree.

Category a
- Sub Category a1
--sub sub category a11
--sub sub category a12
--sub sub category a13
Category b
- Sub Category b1
--sub sub category b11
--sub sub category b12
--sub sub category b13

I want to expand only the first 2 levels like...
Category a
+Sub Category a1
Category b
+ Sub Category b1

How would I do this?  I am using a database to pull in the values and relationships.

Thanks, Marty

EDIT: I found the solution in the forum

protected void RadTreeView1_NodeDataBound(object sender, RadTreeNodeEventArgs e)
    {
        //root nodes only
        if (e.Node.Level == 0)
        {
            e.Node.Expanded = true;
        }
    }

No answers yet. Maybe you can help?

Tags
TreeView
Asked by
moegal
Top achievements
Rank 1
Share this question
or