Event on select item from drop down list

4 posts, 0 answers
  1. Jan
    Jan avatar
    7 posts
    Member since:
    Jan 2014

    Posted 08 Jun Link to this post

    Hello,

    Is there any event, if I select some item from DropDownList?

    Yes, I know, there is onEntryAdded and onClientEntryAdded events, but only if mode is set to Token, and moreover this events are fired also when AutoCompleteBox lost focus.

    I need to things:
    1. set AllowCustomEntry to "true"
    2. read item value, when user select some item from DropDownList

    How can I do it?

    Thanks
    Jan

  2. Vessy
    Admin
    Vessy avatar
    1663 posts

    Posted 09 Jun Link to this post

    Hi Jan,

    I have just answered your support ticket on the matter, for convenience I am copying my answer here as well:


    Indeed the OnClientEntryAdding and OnClientEntryAdded events are triggered only when the Imput type of the AutoCompleteBox is set to token, and cannot be used if the control is in text mode.

    A possible approach I can suggest you is to get reference to the drop-down element when RadAutoCompleteBox client-side object is loaded and assign standard jQuery click event-handler to it in a similar way:
    <telerik:RadAutoCompleteBox RenderMode="Lightweight" ID="RadAutoCompleteBox1"runat="server" Width="300" MaxResultCount="5" InputType="Text" AllowCustomEntry="true"
        DataTextField="Text" DataValueField="Value" EmptyMessage="Select Product Families"
        OnClientLoad="onLoad">
    </telerik:RadAutoCompleteBox>
     
    <script>
        function onLoad(sender, args) {
            $telerik.$(sender.get_dropDownElement()).click(onClick);
        }
        function onClick(sender, args) {
           //your logic here
        }
    </script>

    You may also find useful the following help article:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/autocompletebox/client-side-programming/objects/radautocompletebox-object


    Regards,
    Vessy
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Jan
    Jan avatar
    7 posts
    Member since:
    Jan 2014

    Posted 10 Jun in reply to Vessy Link to this post

    Hello Vessy,

    I explored documentation from your link thoroughly before I wrote ticket, but there is nothing about get_dropDownElement method.

    So, your solution doesn't include option when item is selected from keyboard (select by arrows, then Enter) and, especially, doesn't allow read value of selected item.

    I think, if AutoCompleteBox type is set to text, values in DropDown are useless. It's very uncomfortable.

    I read this forum http://www.telerik.com/forums/entry-value-is-empty , where users pointed out this problem in AutoCompleteBox 5 years ago, and situation is still the same.

    But there is one way: New client event onClientSelectingItem, fired when user select some item from DropDownList (by mouse or from keyboard), with value of selected item as eventArgs parameter.

    Would you not consider such a modification? I belive that it would improve usability od AutoCompleteBox.

    Thanks, Jan
  4. Vessy
    Admin
    Vessy avatar
    1663 posts

    Posted 14 Jun Link to this post

    Hi Jan,

    I am copying the answer I posted to your support ticket on this subject should other client is interested in the response:

    I cannot help but agree with you that exposing such event would be very useful but, unfortunately, it is not among the planned features for the control. I would suggest that you submit a feature request for such improvement in our Feedback portal, so we can prioritize the item and our developers will consider its implementation depending on the demand for it:
    https://feedback.telerik.com/Project/108


    Regards,
    Vessy
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top