aspnet-4018-components-tree-list-examples-how-to-select-nodes-that-meet-the-specified-criteria.md
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;
}
}
Imports DevExpress.Web.ASPxTreeList
Protected Sub ASPxTreeList1_CustomCallback(ByVal sender As Object,_
ByVal e As DevExpress.Web.ASPxTreeList.TreeListCustomCallbackEventArgs)
Dim iterator As TreeListNodeIterator = ASPxTreeList1.CreateNodeIterator()
Dim node As TreeListNode
Do While True
node = iterator.GetNext()
If node Is Nothing Then
Exit Do
End If
If CDec(node("BUDGET")) > 500000D Then
node.Selected = True
End If
Loop
End Sub