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

How clear combobox at client-side

1 Answer 149 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
archimede
Top achievements
Rank 1
archimede asked on 04 Apr 2019, 10:34 AM

Good morning

I shall create a functionality for my users: at double click on RadComboBox (with the dropdown close) the combo is cleared.

ComboBoxs don't have client-side events as double click, right click, or others events that I can use.

Can you help me? How can I do this directly with combo?

1 Answer, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 08 Apr 2019, 09:37 AM
Hello Archimede,

You can attach a double click handler to the combobox wrapper and clear the selection via the clearSelection method as shown below:

<telerik:RadComboBox ID="RadCombobox1" OnClientLoad="OnClientLoad" runat="server" AllowCustomText="true">
    <Items>
        <telerik:RadComboBoxItem Text="Item1" />
    </Items>
</telerik:RadComboBox>
<input onclick="clearCombo(); return false;" value="Clear Combo" type="button" />
<script>
    function OnClientLoad(combo, args) {
        var comboWrapper = combo.get_element();
        $telerik.$(comboWrapper).dblclick(function () {
            combo.clearSelection();
        });
    }
</script>


Best regards,
Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ComboBox
Asked by
archimede
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or