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

$find returns null for dynamically created RadComboBox in custom control in RadWindow

1 Answer 135 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Trevor
Top achievements
Rank 1
Trevor asked on 09 Dec 2014, 10:04 PM
We have a custom control we've created for lookups using RadComboBox.  The RadComboBox portion of the custom control is created dynamically in code.

In our web page, we have a RadWindow, containing an instance of this custom control.  If you enter text in the RadComboBox, it pops up the RadComboBox's DropDownList.  If, while this DropDownList is displayed, you close or cancel out of the parent RadWindow, the RadComboBox's DropDownList remains displayed until the user clicks elsewhere on the page.

I've read that to get around this, you would attach a BeforeClose or Close Client-side Event Handler to the RadWindow, with the following code.

var control = $find("<%=RadComboBox.ClientID%>");
control.hideDropDown();

However, $find() is always returning null.  I've even tried hard coding the ID of the RadComboBox into the $find method.  I thought I'd read somewhere that if you are creating telerik controls dynamically in this fashion, then $find will not work.  Is this true?  If so, what is the work around?

I've tried variations of jQuery/javascript with show(), hide(), visibile = true/false without much luck.  The end result of those trials usually resulted in the DropDownList failing to return, or when it did, it displayed in a different part of the screen, or retained it's previous values after the RadWindow was closed/reopened.

1 Answer, 1 is accepted

Sort by
0
Peter Filipov
Telerik team
answered on 12 Dec 2014, 11:23 AM
Hello Trevor,

Could you please send me a sample which reproduces the described behavior. If the the RadComboBox ID is not set it will be generated automatically.

Regards,
Peter Filipov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ComboBox
Asked by
Trevor
Top achievements
Rank 1
Answers by
Peter Filipov
Telerik team
Share this question
or