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

Selecting Dropdown item from javascript

2 Answers 60 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Jonah
Top achievements
Rank 1
Jonah asked on 09 Dec 2014, 06:24 PM
I have a dropdown list that is inside a content template of a radwindow. I am trying to change the selected item in the dropdown list when the window is opened.
I have tried several things including
var cbo = $telerik.findControl(document, "RddPayRate");
cbo.selectedIndex = 0;
cbo._selectedText = "0.00";
cbo._selectedValue = "0.00";
cbo.commitChanges();
I also tried the set_value method, however it get an error
Anyone know how I would go about changing the selected item from javascript?

2 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 12 Dec 2014, 11:39 AM
Hello,

You have to obtain a reference to the item, and then call the select()​ method of that item:
var item = cbo.get_items().getItem(0);
item.select();

For more information about the Client API of the control please visit our online documentation:
http://www.telerik.com/help/aspnet-ajax/dropdownlist-clientsideprogramming-clientsidebasic.html

Regards,
Bozhidar
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.

 
0
Jonah
Top achievements
Rank 1
answered on 12 Dec 2014, 03:30 PM
That worked, thanks alot
Tags
DropDownList
Asked by
Jonah
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Jonah
Top achievements
Rank 1
Share this question
or