How do I add a Clear button to a DropDownList?

1 Answer 978 Views
DropDownList
Sean
Top achievements
Rank 1
Sean asked on 11 Jun 2023, 10:31 PM
How do I add a Clear button to a DropDownList?  The docs say that it can be done, but don't give any examples that I can find.

1 Answer, 1 is accepted

Sort by
1
Nadezhda Tacheva
Telerik team
answered on 14 Jun 2023, 02:17 PM

Hi Sean,

I see a colleague of mine already answered in your private ticket. I will post the information here as well for visibility and in case any other community member is interested in this scenario.

In general, the DropDownList component does not provide a built-in clear button as in the ComboBox component, for example. Thank you once again for identifying this discrepancy in our documentation. I've already updated it and the changes are pending approval.

The desired result can be achieved with a custom approach by adding a button and handling its onclick to clear the DropDownList value. Here is a runnable sample: https://blazorrepl.telerik.com/wHaqvwPe19zqGzQp45.

In addition, if you want to display the button inside the main element of the DropDownList, you can use this approach: https://blazorrepl.telerik.com/cdYAbylu04u4fslu34.

Regards,
Nadezhda Tacheva
Progress Telerik

As of R2 2023, the default icon type will be SVG instead of Font. See this blogpost for more information.
Tags
DropDownList
Asked by
Sean
Top achievements
Rank 1
Answers by
Nadezhda Tacheva
Telerik team
Share this question
or