Grouping Overview

The DropDownList supports binding to a grouped data source. Define a datasource group expression to group the data by using the Custom DataSource configuration. You need to specify the field that the widget should group by:

The example below demonstrates how to group the data in the DropDownList by Country:

Example
```
@(Html.Kendo().DropDownList()
    .Name("customers")
    .DataSource(source =>  source
        .Custom()
        .Group(g => g.Add("Country", typeof(string)))
        .Transport(transport => transport
            .Read(read =>
            {
                read.Action("Grouping_GetCustomers", "DropDownList");
            }))
        )
    .DataTextField("ContactName")
    .DataValueField("CustomerID")
)
```

Important

The data source sorts the grouped data either in ascending or descending order. If you want to persist a specific group order, use the server grouping feature. Use the DataSource ServerGrouping method to define the serverGrouping option.

## See Also

In this article
Not finding the help you need? Improve this article