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

Rad Tree view Unchecked nodes

5 Answers 168 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Srinivasa Rao Ranga
Top achievements
Rank 1
Srinivasa Rao Ranga asked on 01 Sep 2010, 02:16 PM
Hi,

    There is a way to get checked nodes by using CheckedNodes property.
     I want to get unchecked nodes, is there any best way to get this done.

Thanks Raj

5 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 02 Sep 2010, 08:45 AM
Hi Srinivasa Rao Ranga,

We'll the only way to get the unchecked nodes is to iterate through the collection of all RadTreeView nodes and check the state of the current node.  If it is unchecked, add it to a new collection and that way you'll have a collection of all unchecked nodes.

server-side:
List<RadTreeNode> uncheckedNodes = new List<RadTreeNode>();
       foreach (RadTreeNode node in RadTreeView1.Nodes)
       {
           if (!node.Checked)
           {
               uncheckedNodes.Add(node);
           }
       }

client-side:
function getUncheckedNodes() {
            var uncheckedNodes = new Array();
            var tree = $find("<%= RadTreeView1.ClientID %>");
            for (var i = 0; i < tree.get_allNodes().length; i++) {
                var node = tree.get_allNodes()[i];
                if (!node.get_checked()) {
                    uncheckedNodes.push(node);
                    alert(node.get_text());
                }
            }
        }

Feel free to ask me if you have further questions.

Best Regards,
Veronica Milcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Anthony
Top achievements
Rank 1
answered on 22 Oct 2010, 04:06 PM
Hi

I have used the example below to check for Unchecked nodes which works fine however how how can i get a list of the unchecked children of those nodes
0
Veronica
Telerik team
answered on 01 Nov 2010, 11:00 AM
Hello Anthony,

Please accept my apologies for the late reply.

Once you get the unchecked nodes - you can get all child nodes of a node via get_allNodes() function, iterate through it and check which of the children are unchecked too.

function getUncheckedNodes() { 
            var uncheckedNodes = new Array(); 
            var tree = $find("<%= RadTreeView1.ClientID %>"); 
            for (var i = 0; i < tree.get_allNodes().length; i++) { 
                var node = tree.get_allNodes()[i]; 
                if (!node.get_checked()) { 
                     var children = node.get_allNodes();
                      //here you can iterate through 
                      //all children nodes and check their state
                    uncheckedNodes.push(node); 
                    alert(node.get_text()); 
                
            
        }

Please let me know if this was helpful.

Regards,
Veronica Milcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Anthony
Top achievements
Rank 1
answered on 04 Nov 2010, 12:44 PM
Hi Veronica

Yes the post was useful, however i had addressed this Server Side simply using

For Each node In RadTreeViewTCs.GetAllNodes
    'Check if node is checked
 
next

As GetAllNodes returns the full collection of nodes including children.

Many Thanks
0
Aravind
Top achievements
Rank 1
answered on 30 Apr 2013, 09:09 AM
hai 
   I need to check and  uncheck the lastly checked node based on the if condition in javascript,here i paste some code pls replay for this.i use 

  <telerik:RadTreeView ID="RadTreeView1" OnClientNodeChecked="clientNodeChecked"  runat="server" CheckBoxes="True"></telerik:RadTreeView>

  function clientNodeChecked(sender, eventArgs) {
         var node = eventArgs.get_node();
         var childNodes = eventArgs.get_node().get_text();
         var nodetext = eventArgs._node.get_text(); var hdFldLang = document.getElementById("ctl00_ContentPlaceHolder1_hdLangCount").value;
                    if (hdFldLang < 10) {

                      "here nothing needed"
                        }
                        else {
                           but here need following thing i.e i need to uncheck the node if codition flows here childNodes.set_checked(false);
                      node.set_selected(false);
                          eventArgs._node.checked = false;
                        node.set_checked = false;
                         eventArgs._node._properties._checked = false;
                         nodetext.checked = false;
                        node.get_checked() = false
                        childNodes.uncheck();
                        childNodes.set_checked(false);
                        eventArgs.checked = false;
                        childNodes.checked = false; these above lines are not work pls reply me assp ???????????????????????????
                        } } Regards, Aravind


Tags
General Discussions
Asked by
Srinivasa Rao Ranga
Top achievements
Rank 1
Answers by
Veronica
Telerik team
Anthony
Top achievements
Rank 1
Aravind
Top achievements
Rank 1
Share this question
or