Rad Tree view Unchecked nodes

6 posts, 0 answers
  1. Srinivasa Rao Ranga
    Srinivasa Rao  Ranga avatar
    20 posts
    Member since:
    May 2010

    Posted 01 Sep 2010 Link to this post

    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
  2. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 02 Sep 2010 Link to this post

    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
  3. Anthony
    Anthony avatar
    26 posts
    Member since:
    Mar 2009

    Posted 22 Oct 2010 Link to this post

    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
  4. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 01 Nov 2010 Link to this post

    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
  5. Anthony
    Anthony avatar
    26 posts
    Member since:
    Mar 2009

    Posted 04 Nov 2010 Link to this post

    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
  6. Aravind
    Aravind avatar
    9 posts
    Member since:
    Oct 2012

    Posted 30 Apr 2013 Link to this post

    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


Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!