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

How to retrieve client ID of radComboBox client-side

2 Answers 792 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 2
Alex asked on 07 May 2013, 06:25 PM
for simplicity's sake, i would like to call the same javascript function upon the onclientselectedindexchanged event of all the radComboBoxes in my radgrid's popup user control and run some code if the selected item's text = "OTHER". the function is displayed below:
function OnClientSelectedIndexChanged(sender, eventArgs) {
    var item = eventArgs.get_item()
 
    if (item.get_text() == 'OTHER') {
        alert(sender.get_id())       
    }
}

sender.get_id() returns results like:

ctl00_ContentPlaceHolder1_RadGridProductionOrders_ctl00_ctl06_Detail10_ctl05_EditFormControl_RadComboBoxTitleCoverStamping


how can i get just the "RadComboBox_XXX" portion of the result from get_id(), or do i have to use some other method?


2 Answers, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 09 May 2013, 07:03 AM
Hi Alex,

I would suggest that you set the ClientIDMode="Static" property of the RadComboBox that will render its id as it is set in the markup. Thus, you can get the id of the control only.

Kind regards,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
1
Alex
Top achievements
Rank 2
answered on 09 May 2013, 01:22 PM
kate, thanks for your response.

the clientIDMode of the page was set to static already, and I thought that would be enough.
I instead set the clientIDMode of each control and that did it for me.

thanks for your help.
Tags
ComboBox
Asked by
Alex
Top achievements
Rank 2
Answers by
Kate
Telerik team
Alex
Top achievements
Rank 2
Share this question
or