This is a migrated thread and some comments may be shown as answers.

Change Event

6 Answers 2123 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Rick
Top achievements
Rank 1
Veteran
Rick asked on 21 Aug 2019, 08:27 PM
OnChange doesn't seem to be working for me, is there an example somewhere? Not seeing the event in the documentation.

6 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 22 Aug 2019, 06:03 AM
Hello Rick,

The following snippet shows how to handle the ValueChanged event (the only event the DropDownList component has right now): https://docs.telerik.com/blazor-ui/components/dropdownlist/overview#examples.


Regards,
Marin Bratanov
Progress Telerik UI for Blazor
0
Rick
Top achievements
Rank 1
Veteran
answered on 22 Aug 2019, 07:02 PM
Works perfect, thank you.
0
Ivan
Top achievements
Rank 1
answered on 20 May 2020, 06:03 AM

This appears to have changed, and does not show the use of the ValueChanged event.

I simply cannot get this to work..

0
Svetoslav Dimitrov
Telerik team
answered on 20 May 2020, 06:21 AM

Hello,

You can see how to handle the ValueChanged event for the DropDownList from our documentation from this link: https://docs.telerik.com/blazor-ui/components/dropdownlist/events#valuechanged.

Regards,
Svetoslav Dimitrov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Mark
Top achievements
Rank 1
answered on 20 May 2020, 06:57 AM

Getting closer, thanks Svetoslav.

The example provided doesn't appear to work for more complex types, or through the use of data binding (@bind-Value)?

There is an OnChange event however this seems to get fired with no arguments and without updating the bound value..

0
Marin Bratanov
Telerik team
answered on 20 May 2020, 07:03 AM

Hello Mark,

The <ParameterName>Changed events don't allow @bind-<ParameterName> - that's how the framework operates. In fact, the <ParameterName>Change events exist to provide the @bind-<ParameterName> functionality, which is why the can't be used together.

Thus, if you want two-way binding, you should use the OnChange event we provide specifically.

Alternatively, handle the ValueChanged event and simply update the model field, as shown in the docs.

On the possible fields - see what the Value parameter of the drpodown can take in the docs (see the bullet about the Value param): https://docs.telerik.com/blazor-ui/components/dropdownlist/overview#features. Said shortly, numbers, strings, GUIDs and Enum members can be used. If you want to get an entire model, see here: https://docs.telerik.com/blazor-ui/knowledge-base/dropdowns-get-model

On OnChange not working - I'd suggest you open a support ticket and send us a simple runnable snippet that showcases the issue so we can offer a more concrete answer and avoid guessing. You can base it on the documentation example in order to keep it runnable. At the moment, my best guess is that the Value is not a supported type.

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
DropDownList
Asked by
Rick
Top achievements
Rank 1
Veteran
Answers by
Marin Bratanov
Telerik team
Rick
Top achievements
Rank 1
Veteran
Ivan
Top achievements
Rank 1
Svetoslav Dimitrov
Telerik team
Mark
Top achievements
Rank 1
Share this question
or