combo.get_items() error

1 posts, 0 answers
  1. Ahmed
    Ahmed avatar
    2 posts
    Member since:
    Dec 2014

    Posted 20 Dec 2014 Link to this post

    Hello,I want to add an item to a Radcombox by Javascript.
    Here is my code

            function get_data(combobox) {

                var hdcatvalue = document.getElementById("hdcatvalue");
                var combo = $find(combobox);
                combo.trackChanges();
                var comboItem = new Telerik.Web.UI.RadComboBoxItem();

                var request = new XMLHttpRequest();  // Create new request
                request.open("GET", "getvalue.aspx", false);     // Pass false for synchronous
                request.send(null);
                var textval = request.responseText; // '<%=Session["catvalue"] %>';
                var mySplitResult = textval.split("|");
                var gText = mySplitResult[0];
                textval = mySplitResult[1];

                if (hdcatvalue.value != gText && gText != "") {
                    comboItem.set_text(gText);
                    comboItem.set_value(textval);               
                    combo.get_items().add(comboItem);
                    combo.commitChanges();
                }
               hdcatvalue.value = gText;
       }
    I call the prevous function through OnClientFocus client event

    When I try to open the dropdownlist nothing populate (not opened ), but  when I remove:
    * combo.trackChanges();
    * combo.get_items().add(comboItem);
    * combo.commitChanges();

    The combobox works fine. Please advice.

    Thank you

         







Back to Top