[Solved] Kendo DropdownTree filter with parent level will display below all childs ?

1 Answer 12 Views
Control Panel Upgrade
Saranya
Top achievements
Rank 1
Iron
Saranya asked on 13 Mar 2026, 09:50 AM

@(Html.Kendo().DropDownTree() .Name("LocationID") .Label(label => { label.Content("Select an Location..."); }) .DataTextField("Name") .DataValueField("id").Value(Model) .HtmlAttributes(new { style = "width: 100%" }) .Filter(FilterType.Contains) //.LoadOnDemand(true) .DataSource(dataSource => dataSource.Read(read => read.Action("GetLocationListForDDTree", "DataService") ) )) 

 

DropDownTree filter searches all nodes independently.
So when a child matches, it shows only that node, buti required if filter parent node list out all child node? is possible 

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 16 Mar 2026, 02:52 PM

Hi Saranya,

Thank you for reaching out to us.

Based on the provided information I gather that you would like to use filtering in the DropDownTree component. When the result is a child item - only it should be shown. When the result is a parent item - it should be shown alongside all the child elements. Please correct me if I am mistaken.

The built-in DropDownTree filter works at the individual node level — it does not automatically include all children when a parent matches. In order to apply the custom filter you would need additional logic that handles the filtering operation. You can customize the GetLocationListForDDTree method so it returns the matching nodes along with all their descendants:

public JsonResult GetLocationListForDDTree(string filter)
{
    var allLocations = _locationService.GetAll();

    if (!string.IsNullOrEmpty(filter))
    {
        // Find IDs of nodes whose Name contains the filter
        var matchingIds = allLocations
            .Where(x => x.Name.Contains(filter, StringComparison.OrdinalIgnoreCase))
            .Select(x => x.id)
            .ToHashSet();

        // Include all descendants of matching parents
        allLocations = allLocations
            .Where(x => matchingIds.Contains(x.ParentId ?? -1) || matchingIds.Contains(x.id))
            .ToList();
    }

    return Json(allLocations);
}

Give the approach a try and let me know how it works for you.

 

Regards,
Viktor Tachev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Control Panel Upgrade
Asked by
Saranya
Top achievements
Rank 1
Iron
Answers by
Viktor Tachev
Telerik team
Share this question
or