Completed
Last Updated: 10 Jan 2020 13:50 by ADMIN
Release 2.6.0
Michael
Created on: 07 Nov 2019 08:39
Category: DropDownList
Type: Feature Request
1
Make OnChange available for DropDownList

As stated in the documentation the Event OnChange for DropDownList is shown by intellisense but should not be used. However, in some situations it would be very useful to bind the value of the DropDownList and additionally have an event when the value changes, e.g. show additional inputs when a value is selected.

 

Currently it is either possible to have data binding to value by @bind-Value or listen for the changed event by using Value and ValueChanged.

3 comments
ADMIN
Marin Bratanov
Posted on: 10 Jan 2020 13:50

Hi all,

We were making some improvements on the keyboard support and the OnChange event across the board, and we decided to expose it for the DropDownList as well. Its current role is to show the user action (confirmation) of the current value, so that it offers additional functionality over the standard ValueChanged event that is available everywhere in Blazor. For the dropdownlist in particular, it will let you have an event that does not prevent two-way binding, even through there will be no tangible difference with ValueChanged

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
Michael
Posted on: 07 Nov 2019 09:19
Thank you for your fast feedback. I didn't noticed that 2.3.0 was released. The ComboBox is a real alternativ, thank you.
ADMIN
Marin Bratanov
Posted on: 07 Nov 2019 09:11

Hello Michael,

The OnChange event we have is designed to fire when an input is blurred or the user presses Enter while in it. The DropDownList does not have an input and so such an event does not make sense for it - it will fire when ValueChanged fires, assuming we hook it up.

Thus, for such a case you should use the ValueChanged event and update the model field there, as shown in our documentation (see the last snippet): https://docs.telerik.com/blazor-ui/components/dropdownlist/events#valuechanged.

The other alternative I can suggest for you is using the new ComboBox component and its OnChange event: https://docs.telerik.com/blazor-ui/components/combobox/events#onchange. Note that there are some significant differences between the DropDownList and the ComboBox - the combo box acts more like an input.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor