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

[Solved] $find() issue on radComboBox in asp.net Repeater

3 Answers 198 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Dan Padmore
Top achievements
Rank 1
Dan Padmore asked on 21 Aug 2009, 02:24 PM
Hi,

I'm having trouble getting a reference to a RadComboBox client-side, the combo box is contained within an ASP.NET repeater control.
I'm using the Telerik $find() method to get a reference to the control in JavaScript.

Below is an example of the code i'm using.
 - All elements with an ID ending with "cmbFunction" are selected and stored in the variable "functionComboboxes", this works fine.
 - Next, for each found element a reference to the RadComboBox is gotten, this fails (I get a null reference).
 
This technique works when the RadComboBox is not contained within an ASP.NET repeater control.

Does anyone have an idea what the proper way is, to do what i'm trying?

 

$(document).ready(

function() {

 

 

    var functionComboboxes = $("* [id$='cmbFunction']");  
    functionComboboxes.each(function() {  
        var comboBoxId = $(this).attr('id');  
        var comboBox = $find(comboBoxId);  
        FilterIdentification(comboBox);  
    });  
}); 

3 Answers, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 24 Aug 2009, 12:02 PM
Hello Dan,

Most probably the client-side obejcts of the RadComboBox have not been initialized at the moment at which you call the $find. This will happen if the $(document).ready event (DOMContentLoaded) is triggered before the Sys.Application.load event.

Please try the following snippet:
Sys.Application.add_load( function() {
    $("[id$='cmbFunction']").each(function() {
           var comboBoxId = $(this).attr('id');
           var comboBox = $find(comboBoxId);
           FilterIdentification(comboBox);
    });
}); 


Also, the universal selector (*) is rather redundant and may slow the finding of the elements - thus, I removed it.

Best wishes,
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.
0
Dan Padmore
Top achievements
Rank 1
answered on 25 Aug 2009, 06:59 AM
Alex,

Thank you, your solution works!
0
vicky
Top achievements
Rank 1
answered on 02 Nov 2009, 01:22 PM
Hi Alex,

I am using following statement to get RadCobobox instance on client side
var combo = $find('<%= radcbCoursePopup.ClientID%>');  
But some times I am getting instance value  null. I am not using Telerik functions.
Can you suggest different solution for getting the comobox instance without using telrik helper functions.

Manish
Tags
ComboBox
Asked by
Dan Padmore
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Dan Padmore
Top achievements
Rank 1
vicky
Top achievements
Rank 1
Share this question
or