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

How to determine if all nodes are checked

2 Answers 71 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Andrew Currie
Top achievements
Rank 1
Andrew Currie asked on 09 Nov 2009, 04:06 PM
Hi,

I need to determine if all the nodes in my treeview are checked or not.  My treeview filters an assosciated list on the page.

The application is a document management system.  It returns documents of many types, the user can then filter the type based on a tree structure on the left-hand side.  The point being that if all nodes are checked, then there is no need to filter the list of documents.

The only way I can see is to traverse the whole tree strucuture, keeping a count as I go.  Not the neatest solution I think?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 10 Nov 2009, 06:36 AM
Hi Andrew,

I tried another approach by comparing the count of checked nodes and all the nodes in treeview.


cs:
 
    protected void Button1_Click(object sender, EventArgs e) 
    { 
        int checkedcount = RadTreeView1.CheckedNodes.Count; 
        int nodecount = RadTreeView1.GetAllNodes().Count; 
        if( checkedcount== nodecount) 
        { 
            Response.Write("All nodes checked"); 
        } 
    } 

Regards,
Shinu.

0
Andrew Currie
Top achievements
Rank 1
answered on 10 Nov 2009, 09:23 AM
Aha, the GetAllNodes() method.  I simply missed it in the masses that is available!  I was expecting a property.  Thanks very much
Tags
TreeView
Asked by
Andrew Currie
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Andrew Currie
Top achievements
Rank 1
Share this question
or