set_text gives SyntaxError: illegal character

2 posts, 0 answers
  1. Larissa
    Larissa avatar
    19 posts
    Member since:
    Dec 2015

    Posted 16 Feb Link to this post

    I'm trying to populate a RadComboBox but I'm getting this error and I don't know why.

    My RadComboBox:

    <telerik:RadComboBox ID="regTypeComboBox" runat="server" Width="305" Skin="Telerik" OnClientLoad="OnClientLoadHandler" />

    My js:

    function OnClientLoadHandler(sender) {
        var combo;
        combo = sender;

        var serviceUrl = "myUrl";

        var paramData = {

        };

        $.ajax({
            type: 'GET',
            url: serviceUrl,
            contentType: 'application/json; charset=utf-8',
            crossDomain: true,
            data: JSON.stringify(paramData),
            dataType: 'json',
            success: function (response) {
                var listData = response.listData;
                $.each(listData, function (index, element) {
                    var name, id;
                    name = element.NAME;
                    id = element.ID;
                    var comboItem = new Telerik.Web.UI.RadComboBoxItem();
                    comboItem.set_text(name); // --> SyntaxError: illegal character

                    //comboItem.set_text("name"); // --> also SyntaxError: illegal character

                    //comboItem.set_text(""); // --> also SyntaxError: illegal character
                });

    },
            error: function () {
                alert("error");
            }
        });
    }

     

    It is pretty simple, but I don't know why it gives this error.

    Any ideas? Thanks

     

     

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    835 posts

    Posted 19 Feb Link to this post

    Hello Larissa,

    We tested your scenario, but were unable to reproduce the illegal character exception. I attached a sample project, which contains a RadComboBox bound with Web API, could you please try reproducing the error in it and post your modifications for further review?

    Regards,
    Ivan Danchev
    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