This is a migrated thread and some comments may be shown as answers.

set_text gives SyntaxError: illegal character

1 Answer 71 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Larissa
Top achievements
Rank 1
Larissa asked on 16 Feb 2016, 04:05 PM

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

 

 

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 19 Feb 2016, 02:25 PM
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
Tags
ComboBox
Asked by
Larissa
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or