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

[Solved] Radtreeview checkbox OnClientNodeChecking

1 Answer 138 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jon Morris
Top achievements
Rank 1
Jon Morris asked on 24 Feb 2010, 06:17 PM
Hi,

I am using a radtreeview with a sqldatasource. The radtree looks like below:

NODE1
    Subnode1
    Subnode2
NODE2
    Subnode3
    Subnode4

I also have 4 radgrids on the page whose visibility is toggled on/off based on check/uncheck of the nodes. I achieved this by calling a javascript function on "OnClientNodeChecking". So far so good.

I also want to toggle the radgrids based on NODE1/NODE2 check/uncheck, i.e. if I uncheck NODE1, the two grids(associated with subnode1/2) should be hidden. So, I set the "CheckChildNodes" property to "True" which checks/unchecks the child nodes. I assumed that this would trigger the "OnClientNodeChecking" event for all the childs nodes. However, it doesn't. I am not sure if it is desgin issue or if I am missing something. Either way, I would appreciate if anyone can help me resolve this.

Thank you,
Sri

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 25 Feb 2010, 07:43 AM
Hi Jon,

You can check for whether node clicked has child nodes, if yes explicitly show/hide the grids in the same handler.

JavaScript:
 
<script type="text/javascript"
    function OnClientNodeChecking(sender, args) { 
        if (args.get_node().get_text() == 'Root RadTreeNode1') { 
            if (args.get_node().get_nodes().get_count() != 0) { 
                if (args.get_node().get_checked()) { 
                    alert('Hide both'); 
                } 
                else { 
                    alert('Show both'); 
                } 
            } 
        } 
    } 
</script> 

-Shinu.
Tags
TreeView
Asked by
Jon Morris
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or