looping through combox items

2 posts, 1 answers
  1. Binary
    Binary avatar
    10 posts
    Member since:
    Apr 2015

    Posted 25 Sep 2015 Link to this post

    I have the telerik radcombox and I want to loop through all the items on that radcombox before adding any element to it. I want to achieve this at client side.I tried this code but it did not give result I was expecting for. I have application which will add items to the radcombox but before that I want to check element is already there or not. Not sure why my below code is not working.

     

    var combo = $find("<%= MyCombo.ClientID %>");

    var items = combo.get_items();

    for (var i = 0; i < items._array.length; i++) {

        var myradcomboValues= items.getItem(i);

      alert(myradcomboValues);

    }

  2. Answer
    Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 30 Sep 2015 Link to this post

    Hi Binary,

    Please try the following snippet and let me know about the result:
    function pageLoad(app, args) {
        var combo = $find('<%= RadComboBox1.ClientID %>');
        var items = combo.get_items();
        for (var i = 0; i < items.get_count() ; i++) {
            var item = items.getItem(i);
            var value = item.get_value();
            alert(value);
        }
    }

    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top