Adding Items to RadDropDownList on ClientSide

3 posts, 1 answers
  1. Timothy
    Timothy avatar
    6 posts
    Member since:
    Dec 2014

    Posted 23 Dec 2014 Link to this post

    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. Answer
    Plamen
    Admin
    Plamen avatar
    2731 posts

    Posted 25 Dec 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Timothy
    Timothy avatar
    6 posts
    Member since:
    Dec 2014

    Posted 25 Dec 2014 in reply to Plamen Link to this post

    That worked.
    Thank you.

    Merry Christmas.
Back to Top