Skip to main content

How to: Select Nodes That Meet the Specified Criteria

This example demonstrates how to select departments whose budget is greater than $500,000.

The ‘Do Select‘ button’s Click event is handled to call the ASPxClientTreeList.PerformCustomCallback method.

This sends a callback to the server and generates the ASPxTreeList.CustomCallback event. This event is handled to select the required departments. To traverse through the nodes, the Node Iterator is used.

The image below shows the result:


using DevExpress.Web.ASPxTreeList;

protected void ASPxTreeList1_CustomCallback(object sender,
DevExpress.Web.ASPxTreeList.TreeListCustomCallbackEventArgs e) {
    TreeListNodeIterator iterator = ASPxTreeList1.CreateNodeIterator();
    TreeListNode node;
    while (true) {
        node = iterator.GetNext();
        if (node == null) break;
        if ((decimal)node["BUDGET"] > 500000M)
            node.Selected = true;