Admin Admin
Number of posts : 216 Registration date : 2007-01-01
| Subject: How to check all child nodes when parent node is checked Wed Mar 28, 2007 10:46 pm | |
| Give a cool idea to any programmer Try this: Add the following javascript functions to your ASPX page (or ASCX or MasterPage): - Code:
-
function UpdateAllChildren(nodes, checked) { var i; for (i=0; i<nodes.length; i++) { checked ? nodes[i].Check() : nodes[i].UnCheck(); if (nodes[i].Nodes.length > 0) { UpdateAllChildren(nodes[i].Nodes, checked); } } } function CheckChildNodes(node) { UpdateAllChildren(node.Nodes, node.Checked); } Then use the "AfterClientCheck" handler in your control definition: - Code:
-
<radt:radtreeview id="RadTree1" runat="server" AfterClientCheck="CheckChildNodes" ... /> Enjoy! | |
|