Programatically set Listbox value

5 posts, 0 answers
  1. Steve
    Steve avatar
    13 posts
    Member since:
    Jun 2013

    Posted 14 Mar Link to this post

    I have a Kendo ListBox that I need to set a single item selected through a JavaScript function. I know both the text and value that I want to set, but can't figure out how. Any help appreciated!

    Steve.

  2. Eyup
    Admin
    Eyup avatar
    3862 posts

    Posted 15 Mar Link to this post

    Hello Steve,

    You can use the add method to achieve this requirement. You can find a live sample demonstrating that here:
    https://demos.telerik.com/kendo-ui/listbox/api

    I hope this will prove helpful.

    Regards,
    Eyup
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Steve
    Steve avatar
    13 posts
    Member since:
    Jun 2013

    Posted 15 Mar in reply to Eyup Link to this post

    Sorry, that's not quite it. I have an existing list with, say, 5 items in it and I want to select item #2. More specifically, I want to select the one with the value of 2. 
  4. Eyup
    Admin
    Eyup avatar
    3862 posts

    Posted 18 Mar Link to this post

    Hi Steve,

    You can use the select method in this case:
    https://docs.telerik.com/kendo-ui/api/javascript/ui/listbox/methods/select

    I've also provided a live dojo sample for demonstration:
    https://dojo.telerik.com/IjISeBic/6

    Regards,
    Eyup
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Steve
    Steve avatar
    13 posts
    Member since:
    Jun 2013

    Posted 18 Mar in reply to Eyup Link to this post

    Perfect! Thank you!!
Back to Top