How clear combobox at client-side

2 posts, 1 answers
  1. archimede
    archimede avatar
    105 posts
    Member since:
    Jul 2006

    Posted 04 Apr Link to this post

    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?

  2. Answer
    Rumen
    Admin
    Rumen avatar
    14011 posts

    Posted 08 Apr Link to this post

    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.
Back to Top