How to determine if all nodes are checked

3 posts, 1 answers
  1. Andrew Currie
    Andrew Currie avatar
    19 posts
    Member since:
    Jun 2008

    Posted 09 Nov 2009 Link to this post

    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. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Nov 2009 Link to this post

    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.

  3. Andrew Currie
    Andrew Currie avatar
    19 posts
    Member since:
    Jun 2008

    Posted 10 Nov 2009 Link to this post

    Aha, the GetAllNodes() method.  I simply missed it in the masses that is available!  I was expecting a property.  Thanks very much
Back to Top