# Events

This article explains the events available in the Telerik DropDownList for Blazor:

* [ValueChanged](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/events#valuechanged)
* [OnChange](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/events#onchange)
* [OnRead](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/events#onread)
* [OnOpen](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/events#onopen)
* [OnClose](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/events#onclose)
* [OnItemRender](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/events#onitemrender)
* [OnBlur](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/events#onblur)

The examples in this article use `string` values and simple data sources for brevity. You can use full models, see the [data binding](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/data-bind) article for more details.

## ValueChanged

The `ValueChanged` event fires upon every change of the user selection.

The example below uses [binding](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/data-bind) to string data for brevity. You can use full models as well. The type of the argument in the lambda expression must match the `Value` type of the component, and the `ValueField` type (if `ValueField` is set).

> caption Handle DropDownList ValueChanged

<demo metaUrl="client/dropdownlist/events/value-changed/" height="250"></demo>

> tip The event is an `EventCallback`. It can be synchronous and return `void`, or asynchronous and return `async Task`. Do not use `async void`.

> note The lambda expression in the handler is required by the framework: <https://github.com/aspnet/AspNetCore/issues/12226>.

## OnChange

The `OnChange` event represents a user action - confirmation of the current value. In inputs, it fires when the user presses `Enter` in the input, or when the input loses focus. In the DropDownList, it fires when the user selects an item as well. See [here](https://www.telerik.com/blazor-ui/documentation/knowledge-base/common-onchange-fires-twice) for sample logic on executing it only once per value selection.

> tip The `OnChange` event is a custom event and does not interfere with bindings, so you can use it together with models and forms.

> caption Handle the OnChange event and use two-way binding

<demo metaUrl="client/dropdownlist/events/on-change/" height="280"></demo>

> tip The event is an `EventCallback`. It can be synchronous and return `void`, or asynchronous and return `async Task`. Do not use `async void`.

## OnRead

You can use the [`OnRead` event](https://www.telerik.com/blazor-ui/documentation/common-features/data-binding/onread) to provide data to the component based on custom logic and the current user input and/or scroll position (when using [virtualization](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/virtualization)). The event fires when:

* The component initializes.
* The user [filters](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/filter).
* The user scrolls with [virtualization](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/virtualization) enabled.

Find out how to [get the applied filtering and grouping criteria](https://www.telerik.com/blazor-ui/documentation/common-features/data-binding/descriptors).

You can also call remote data through `async` operations.

> caption Provide custom data based on user input in the DropDownList

> tip You can also debounce the service calls and implement minimum filter length. An example of such approach is available in [this knowledge base article for the ComboBox](https://www.telerik.com/blazor-ui/documentation/knowledge-base/combo-debounce-onread). The same approach is applicable for the DropDownList.

> important The `OnRead` handler should change **only the data** of the component, and **not** other parameters such as `Value`. This can lead to issues with the asynchronous nature of the event, and race conditions can occur with the arrival of the new data. Moreover, such a change is likely to be unexpected by the user and cause bad UX.

<demo metaUrl="client/dropdownlist/events/on-read-custom/" height="320"></demo>

> tip This example uses plain strings for brevity, you can use full models - see the [data binding](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/data-bind) article for examples.

> caption Filter large local data through the Telerik DataSource extensions

<demo metaUrl="client/dropdownlist/events/on-read-local/" height="350"></demo>

## OnOpen

The `OnOpen` event fires before the DropDownList popup renders.

The event handler receives a `DropDownListOpenEventArgs` object that contains:

<style>
    .article table {
        table-layout: auto;
        word-break: normal;
    }
</style>

| Property      | Description                                                                  |
| ------------- | ---------------------------------------------------------------------------- |
| `IsCancelled` | Set the `IsCancelled` property to `true` to cancel the opening of the popup. |

<demo metaUrl="client/dropdownlist/events/on-open/" height="280"></demo>

## OnClose

The `OnClose` event fires before the DropDownList popup closes.

The event handler receives a `DropDownListCloseEventArgs` object that contains:

| Property      | Description                                                                  |
| ------------- | ---------------------------------------------------------------------------- |
| `IsCancelled` | Set the `IsCancelled` property to `true` to cancel the closing of the popup. |

<demo metaUrl="client/dropdownlist/events/on-close/" height="280"></demo>

## OnItemRender

The `OnItemRender` event fires when each item in the DropDownList popup renders.

The event handler receives as an argument an `DropDownListItemRenderEventArgs<TItem>` object that contains:

| Property | Description                                          |
| -------- | ---------------------------------------------------- |
| `Item`   | The current item that renders in the DropDownList.   |
| `Class`  | The custom CSS class that will be added to the item. |

<demo metaUrl="client/dropdownlist/events/on-item-render/" height="300"></demo>

## OnBlur

The `OnBlur` event fires when the component loses focus.

> caption Handle the OnBlur event

<demo metaUrl="client/dropdownlist/events/on-blur/" height="250"></demo>

## See Also

* [ValueChanged and Validation](https://www.telerik.com/blazor-ui/documentation/knowledge-base/value-changed-validation-model)
* [Fire OnChange Only Once](https://www.telerik.com/blazor-ui/documentation/knowledge-base/common-onchange-fires-twice)
* [Blazor DropDownList](https://www.telerik.com/blazor-ui/documentation/components/dropdownlist/overview)
