Skip to main content

Filtering in Code

  • 2 minutes to read

To filter Tree List nodes in code, utilize the following API:

Disable the TreeListOptionsCustomization.AllowFilter option to prevent a user from applying and changing Tree List filters at runtime.

Turn off the TreeList.ActiveFilterEnabled setting to temporarily disable applied filters.


The example below ensures that Tree List records with the 15% discount are always visible, regardless of the currently applied filtering condition.

TreeList - Custom Filter

private void TreeList1_CustomRowFilter(object sender, CustomRowFilterEventArgs e) {
    TreeList treeList = sender as TreeList;
    string discount = treeList.GetRowCellDisplayText(e.Node, treeList.Columns["Discount"]);
    if (discount == "15%") {
        e.Visible = true;
        e.Handled = true;