how to expand nodes by level

1 posts, 0 answers
  1. moegal
    moegal avatar
    273 posts
    Member since:
    Jul 2007

    Posted 05 Oct 2012 Link to this post

    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;
            }
        }

Back to Top