Click event not firing for AutoCompleteSuggestHelper Popup of RadDropDownList

1 Answer 47 Views
AutoCompleteBox DropDownList
Kamil
Top achievements
Rank 1
Kamil asked on 28 Nov 2021, 02:59 PM | edited on 28 Nov 2021, 03:00 PM

Hi, I made my own inherited version of RadDropDownList that uses own inherited version of RadAutoCompleteBoxElement for a TextBoxElement (I wanted tokenized text items). I also got my own custom arrow that inherits RadArrowButtonElement, because I do not use the DataSource at all (only Suggest items popup is shown by this custom arrow).
This control works fine if it is used in Designer of the regular form, but when created dynamically the AutoCompleteSuggestHelper.DropDownList.Popup.Click() event does not fire (sidenote: the event AutoCompleteSuggestHelper.DropDownList.KeyDown() event works).

When the control is not created in code behind it is working completely fine. Any suggestions on how to fix it?

1 Answer, 1 is accepted

Sort by
0
Accepted
Dinko
Telerik team
answered on 30 Nov 2021, 01:49 PM

Hi Kamil,

Thank you for the provided image.

When the control is added from the designer, by default its DropDownAnimationEnabled property is set to true. When the animation is turned on, the Click event is handled in code. In your case, you can try setting the DropDownAnimationEnabled property of the RadDropDownList to true when adding the control in code behind.

Give this property a try and let me know how it goes.

Regards,
Dinko
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Kamil
Top achievements
Rank 1
commented on 01 Dec 2021, 02:01 PM

It didn't help. I attached my custom drop down list. Please make a project with System.Windows.Forms.Form() and use method GetDropDownList() from DropDownListHelper class. Also create this control in Form's designer to compare the difference in behaviour. This control is supposed to imitate a 'load on demand' feature - the code provided is working on a static data to simpify the issue.
Dinko
Telerik team
commented on 03 Dec 2021, 10:22 AM

Thank you for the provided files. I have created a sample project using your files. In the project, I have subscribed to the DropDownList.Popup.Click() event, and when I click on an item inside the dropdown, the event handler is called. May I ask you to check the project and share what I am missing from your scenario? 

Kamil
Top achievements
Rank 1
commented on 03 Dec 2021, 11:05 AM | edited

Thank you for answering. I know why there is a difference between our experiences:

1. In CustomAutoCompleteSuggestHelper i hooked the CustomAutoCompleteSuggestHelper.Popup_Click() event to this.DropDownList.Popup.Click (in CustomAutoCompleteSuggestHelper constructor) but it did not fire when the CustomDropDownList was created during runtime.

2. You created a Popup_Click() inside the Form, so that's why it worked in your project. I was hoping that my CustomAutoCompleteSuggestHelper.Popup_Click() event could work, so that I wouldn't need to remember to add this event every time I create the CustomDropDownList.

All things considered, your approach helped me to find out what went wrong, so you can close this thread.

Tags
AutoCompleteBox DropDownList
Asked by
Kamil
Top achievements
Rank 1
Answers by
Dinko
Telerik team
Share this question
or