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

[Solved] RadComboBox and jquery

3 Answers 251 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
wnl
Top achievements
Rank 1
wnl asked on 17 Aug 2009, 11:48 AM

Hi,
I want to find RadComboBox on a page with jquery and set some text to this control. My code:

$telerik.$("[id$='RadComboBox1']").set_text('sas'); 

but it doesn't work properly. Why?
With $find it works fine:

contentWin.$find("RadComboBox1").set_text('asdfgh') 

3 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 17 Aug 2009, 12:07 PM
Hello Jaromin Sycz,

The jQuery selector finds the DOM element while you need to find the RadComboBox javascript object. That is why the $find method works in your case.

Regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
wnl
Top achievements
Rank 1
answered on 21 Aug 2009, 09:36 AM
Add how to find 'RadComboBox1' when I'm using master pages and some chars are added to the id eg. 'ctl00_' but I don't know these before?
0
Alex Gyoshev
Telerik team
answered on 21 Aug 2009, 03:03 PM
Hi Jaromin,

The server-side property RadComboBox1.ClientID gives you the client ID of the combo. Therefore, you can use:

contentWin.$find("<%= RadComboBox1.ClientID %>").set_text('asdfgh')

The approach above is faster, but to make this answer complete: you can also use the following jQuery:

$telerik.$("[id$='RadComboBox1']")[0].control.set_text('sas');

Regards,
Alex
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
ComboBox
Asked by
wnl
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
wnl
Top achievements
Rank 1
Alex Gyoshev
Telerik team
Share this question
or