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

Adding Items to RadDropDownList on ClientSide

2 Answers 484 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Timothy
Top achievements
Rank 1
Timothy asked on 23 Dec 2014, 05:45 PM
Hello,

I'm trying to manipulate the items in my raddropdownlist via jquery.

I found this page with documentation:
http://www.telerik.com/help/aspnet-ajax/dropdownlistitemcollection-client-object-api.html

the Add() method requires a DropDownListItem parameter.
But I can't find any documentation on how to declare a var of that type.
Is it in a namespace somewhere that I haven't found?

Please advise.
Thank you.

2 Answers, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 25 Dec 2014, 06:05 AM
Hi Timothy,

Here is a sample code that worked correctly at my side:
var ddl = $find("<%=DropDownListItem1.ClientID %>");
               var newItem = new Telerik.Web.UI.DropDownListItem();
               newItem.set_text("new");
              
               ddl.get_items().add(newItem);

Hope this will help you solve the issue.

Regards,
Plamen
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
Timothy
Top achievements
Rank 1
answered on 25 Dec 2014, 12:46 PM
That worked.
Thank you.

Merry Christmas.
Tags
DropDownList
Asked by
Timothy
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Timothy
Top achievements
Rank 1
Share this question
or