RadTreeView for ASP.NET

Checking/unchecking all child nodes for a particular node. Send comments on this topic.
See Also
Example scenarios (How to) > Client -side > Checking/unchecking all child nodes for a particular node.

Glossary Item Box

To check all child-nodes when a parent node has been checked, you need to subscribe to the AfterClientCheck event tat is fired right after a node has been checked.

Example:

ASPX Copy Code
<script language=javascript>

function UpdateAllChildren(nodes, checked)
{

//In the client-side event handler, obtain a reference to the parent node. Then, check/uncheck all the child-nodes in the parent collection.
var i;
for (i=0; i
<nodes.length; i++)
{
 if (checked)
 {
  nodes[i].Check();
 }
 else
 {
  nodes[i].UnCheck();
 }
 if (nodes[i].Nodes.
length > 0)
 {
  UpdateAllChildren(nodes[i].Nodes, checked);
 }
}
}
function AfterCheck(node)
{
UpdateAllChildren(node.Nodes, node.Checked);
}
</script>



<
rad:RadTreeView runat="server" CheckBoxes="True" AfterClientCheck="AfterCheck" />
        

 

See Also