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

Event on select item from drop down list

3 Answers 647 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Jan
Top achievements
Rank 1
Jan asked on 08 Jun 2017, 12:14 PM

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

3 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 09 Jun 2017, 10:42 AM
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.
0
Jan
Top achievements
Rank 1
answered on 10 Jun 2017, 08:07 PM
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
0
Vessy
Telerik team
answered on 14 Jun 2017, 02:43 PM
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.
Tags
AutoCompleteBox
Asked by
Jan
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Jan
Top achievements
Rank 1
Share this question
or