Node Check Event d'ont work after click button

4 posts, 0 answers
  1. EssMus
    EssMus avatar
    18 posts
    Member since:
    Jan 2015

    Posted 13 Apr 2015 Link to this post

    hi,

    in first pic i have tree view wich it bind from DB and i have button i have some instruction in envent nodecheck before i click button the event work after clicking and binding gridview the instruction in nodecheck  dosen't work i dont know plz help 

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    837 posts

    Posted 14 Apr 2015 Link to this post

    Hello,

    Could you please provide more details on your scenario, because we don't have access to your code? It would be helpful if you can post your code and describe what are you trying to achieve and chain of actions that lead to the issue so we can try to find a solution.

    Regards,
    Ivan Danchev
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sunil
    Sunil avatar
    1 posts
    Member since:
    Apr 2015

    Posted 16 Apr 2015 in reply to EssMus Link to this post

    can  you seen the scenario that when all the child nodes in Radtree are checked then parent node node get gets checked  automatically 

     could you find on thizz solution by using cilent side scripting 

     

  5. Ivan Danchev
    Admin
    Ivan Danchev avatar
    837 posts

    Posted 20 Apr 2015 Link to this post

    Hello,

    Please, review and try the code in code snippet below and let us know if you still have the issue. Using the OnClientNodeChecked event handler we combine the following functionality: when all child nodes are checked it checks their parent node; when one of the child node is unchecked it unchecks their parent node; when a parent node is checked/unchecked it checks/unchecks its child nodes:
    <telerik:RadTreeView runat="Server" ID="RadTreeView1" CheckBoxes="True" OnClientNodeChecked="clientNodeChecked">

    function UpdateAllChildren(nodes, checked) {
        var i;
        var test;
        for (i = 0; i < nodes.get_count() ; i++) {
            if (checked) {
                nodes.getNode(i).check();
            }
            else {
                nodes.getNode(i).set_checked(false);
            }
     
            if (nodes.getNode(i).get_nodes().get_count() > 0) {
                UpdateAllChildren(nodes.getNode(i).get_nodes(), checked);
            }
        }
    }
     
    function clientNodeChecked(sender, eventArgs) {
     
        var childNodes = eventArgs.get_node().get_nodes();
        var isChecked = eventArgs.get_node().get_checked();
        UpdateAllChildren(childNodes, isChecked);
     
        var node = eventArgs.get_node();
        if (!node.get_checked()) {
            while (node.get_parent().set_checked != null) {
                node.get_parent().set_checked(false);
                node = node.get_parent();
            }
        }
        else {
            var parent = node.get_parent();
            var count = parent.get_nodes().get_count();
     
            var allChildChecked = false;
            for (i = 0; i < count ; i++) {
                if (!parent.get_nodes().getNode(i).get_checked()) {
                    allChildChecked = false;
                    return;
                }
                else {
                    allChildChecked = true;
                }
            }
            if (allChildChecked) {
                parent.set_checked(true);
            }
        }
    }

    Regards,
    Ivan Danchev
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top