# Filtering a DropDownList by Multiple Properties

## Environment

<table>
 <tr>
  <td>Product</td>
  <td>Telerik UI for ASP.NET MVC DropDownList</td>
 </tr>
 <tr>
  <td>Progress Telerik UI for ASP.NET MVC version</td>
  <td>Created with the 2022.2.621 version</td>
 </tr>
</table>

## Description

How can I filter the DropDownList data by multiple properties on the client-side when working with the Telerik UI for ASP.NET MVC components?

## Solution

1. Subscribe to the [`Filtering`](https://docs.telerik.com/aspnet-mvc/api/kendo.mvc.ui.fluent/dropdownlisteventbuilder#filteringsystemstring) event.
2. Prevent the default behavior of the `Filtering` event.
3. Use the dataSource [`filter`](https://docs.telerik.com/kendo-ui/api/data/datasource/methods/filter) method to apply the custom filtering.

```Razor Index.cshtml
    @(Html.Kendo().DropDownList()
          .Name("dropDownList")
          .DataTextField("Text")
          .DataValueField("Value")
          .Filter(FilterType.Contains)
          .Events(e => e.Filtering("onFilter"))
          .BindTo(new List<SelectListItem>() {
              new SelectListItem() {
                  Text = "Maria Anders",
                  Value = "H120"
              },
              new SelectListItem() {
                  Text = "Ana Trujilo",
                  Value = "H220"
              },
              new SelectListItem() {
                  Text = "Antonio Moreno",
                  Value = "H320"
              }
          })
          .Template("#: data.Text # (#: data.Value #)")
          .HtmlAttributes(new { style = "width: 100%" })
    )
```

```JS script.js
    <script>
        function onFilter(e){
            e.preventDefault();
            var filterValue = e.filter != undefined ? e.filter.value : ""; //get the filter value

            this.dataSource.filter({ //apply the required filter logic
              logic: "or",
              filters: [
                {
                  field: "Text",
                  operator: "contains",
                  value: filterValue
                },
                {
                  field: "Value",
                  operator: "contains",
                  value: filterValue
                }
              ]
            });
        }
    </script>  
```

For the complete implementation of the suggested approach, refer to the following [Telerik REPL](https://netcorerepl.telerik.com/ccOqQLvn39tnt1Zy03) example.

## More ASP.NET MVC DropDownList Resources

* [ASP.NET MVC DropDownList Documentation](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/editors/dropdownlist/overview)

* [ASP.NET MVC DropDownList Demos](https://demos.telerik.com/aspnet-mvc/dropdownlist)

* [ASP.NET MVC DropDownList Product Page](https://www.telerik.com/aspnet-mvc/dropdownlist)

* [Telerik UI for ASP.NET MVC Video Onboarding Course (Free for trial users and license holders)](https://www.telerik.com/aspnet-mvc/documentation/getting-started/video-onboarding)

* [Telerik UI for ASP.NET MVC Forums](https://www.telerik.com/forums/aspnet-mvc)

## See Also

* [Telerik REPL: Filtering a DropDownList by Multiple Properties](https://netcorerepl.telerik.com/ccOqQLvn39tnt1Zy03)
* [Client-Side API Reference of the DropDownList for ASP.NET MVC](https://docs.telerik.com/kendo-ui/api/ui/dropdownlist)
* [Server-Side API Reference of the DropDownList for ASP.NET MVC](https://docs.telerik.com/aspnet-mvc/api/dropdownlist)
* [Telerik UI for ASP.NET MVC Breaking Changes](https://www.telerik.com/aspnet-mvc/documentation/backwards-compatibility/2023-backwards-compatibility)
* [Telerik UI for ASP.NET MVC Knowledge Base](https://docs.telerik.com/aspnet-mvc/knowledge-base)
