Selection

  • 2 minutes to read

The ASPxTreeList allows users to select (or clear) a node’s check box to select (or deselect) the corresponding node.

Run Demo

Set the Enabled property to true to display the node check boxes. Set the AllowSelectAll property to true to display a check box in the column header panel that selects/deselects all nodes.

<dx:ASPxTreeList ID="treeList" runat="server" DataSourceID="DepartmentsDataSource" KeyFieldName="ID">
    <SettingsSelection Enabled="True" AllowSelectAll="True"/>
    <!-- ... -->

cdDataSelection

Set a node’s AllowSelect property to false to hide the node’s check box and prevent the node from being selected.

The example below shows how to prevent users from selecting a node that has no child nodes.

TreeListNodeIterator iterator = treeList.CreateNodeIterator();
TreeListNode node;
while (true) {
    node = iterator.GetNext();
    if (node == null) break;
    node.AllowSelect = node.HasChildren; 
}

Refer to the following section for the complete example: How to: Select Nodes That Meet the Specified Criteria.

Recursive Selection

Set the Recursive property to true to make recursive selection available.

<dx:ASPxTreeList ID="treeList" runat="server" DataSourceID="DepartmentsDataSource" KeyFieldName="ID">
    <SettingsSelection Enabled="True" Recursive="True"/>
    <!-- ... -->

When recursive selection is available for users:

  • A parent node is automatically selected when all its child nodes are selected. Deselecting a child node automatically deselects its parent node(s).

  • When a user selects a parent node, its child nodes are automatically selected - including child nodes that are hidden with a filter.

  • A node that has selected and unselected child nodes is displayed with a grayed check box.

animRecursiveSelection

Refer to the following section for the complete example: How to: Enable Recursive Selection When Binding at Runtime.

See Also