New to Telerik UI for Blazor? Download free 30-day trial

OnChange fires twice


Product DropDownList for Blazor, ComboBox for Blazor, AutoComplete for Blazor, TextBox for Blazor, NumericTextBox for Blazor


I observe twice firing onchange event in dropdownlist or other inputs.

I want the event to fire only once when the user selects something.

Cause\Possible Cause(s)

The OnChange event is a user confirmation event - it fires when the user chooses an item from the dropdown list, and also when the user blurs an input (the dropdownlist is, in essence, an input).

For example, pressing Enter in an input will fire the event, but will not remove the focus from the input. Thus, the next click on the page (on a button, another component) will fire the event again.


As of 2.22.0, you can use the OnBlur event of the components to capture the focusout event, so you may not need to use OnChange.

If you want to execute some business logic (such as fetching data) only once per value change, but you want to keep using the @bind-Value to populate your models, you can keep the last value with which OnChange fired and compare against it.

Execute OnChange once per value selection

@* monitor the console and try the following to see the difference:
    - selecting the same item several times
    - clicking away from the dropdownlist after selecting an item

<br />
<TelerikDropDownList Data="@MyList" OnChange="@MyOnChangeHandler" @bind-Value="@MySelectedItem">

@code {
    string MySelectedItem { get; set; }
    protected List<string> MyList = new List<string>() { "first", "second", "third" };

    string lastOnChangeValue { get; set; }

    void MyOnChangeHandler(object theUserInput)
        string currValue = theUserInput as string;

        Console.WriteLine($"OnChange fired for value: {currValue}");

        if (!currValue.Equals(lastOnChangeValue))
            //this is where you execute the business logic you want to fire once per selected value
            Console.WriteLine($"Executing business logic for value {currValue}, such as loading data");

        lastOnChangeValue = currValue;
In this article