Rudebox.co.nr How To Forums

Rudebox How To Forums - Ask Anything, View How To's
Home­FAQ­Search­Register­Memberlist­Usergroups­Log in
Post new topic   Reply to topicShare | 
 

 How to check all child nodes when parent node is checked

View previous topic View next topic Go down 
AuthorMessage
Admin
Admin


Number of posts: 206
Registration date: 2007-01-01

PostSubject: How to check all child nodes when parent node is checked   Thu Mar 29, 2007 4:46 am

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!
Back to top Go down
View user profile http://rudebox.editboard.com
 

How to check all child nodes when parent node is checked

View previous topic View next topic Back to top 
Page 1 of 1

Permissions of this forum:You cannot reply to topics in this forum
Rudebox.co.nr How To Forums :: How To - Myspace / Website /Blog Utilities :: ASP .net-
Post new topic   Reply to topic