Selecting Dropdown item from javascript

3 posts, 0 answers
  1. Jonah
    Jonah avatar
    21 posts
    Member since:
    Oct 2012

    Posted 09 Dec 2014 Link to this post

    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. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 12 Dec 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jonah
    Jonah avatar
    21 posts
    Member since:
    Oct 2012

    Posted 12 Dec 2014 in reply to Bozhidar Link to this post

    That worked, thanks alot
Back to Top