We are getting a strange error message in our ASP.NET MVC application. There error is thrown when we try to populate a dropdown list with some data.
At some point we got an error that says:
Uncaught ReferenceError: Disabled is not defined
at Object.eval [as template] (eval at compile (kendo.all.js:313050:21), :3:92)
at init._renderItem (kendo.all.js:313050:21)
at init._render (kendo.all.js:313050:21)
at init.refresh (kendo.all.js:313050:21)
at init.trigger (kendo.all.js:313050:21)
at init._process (kendo.all.js:313050:21)
at init.success (kendo.all.js:313050:21)
at success (kendo.all.js:313050:21)
at n.success (kendo.all.js:313050:21)
at fire (jquery-3.7.1.js:3223:31)
The error points at the following fucntion in kendo
(function anonymous(data) {
var $kendoOutput, $kendoHtmlEncode = kendo.htmlEncode;
with (data) {
$kendoOutput = 'n ';
if (Disabled) {
;$kendoOutput += 'n <span class="disabledText">' + $kendoHtmlEncode(Text) + ' </span> ';
} else {
;$kendoOutput += 'n <span>' + $kendoHtmlEncode(Text) + ' </span> ';
}
;$kendoOutput += 'n ';
}
return $kendoOutput;
})
The worst part is that this was working a month ago, meanwhile we did not change anything.
This is how we use the kendo.
<input id="clients" value="@Model.ClientId" style="width: 90%;" />
<script language="JavaScript">
$(document).ready(function () {
var clients = $("#clients").kendoDropDownList({
dataTextField: "Text",
dataValueField: "Value",
template: kendo.template($("#activeDisabledTemplate").html()),
filter: "contains",
dataSource: {
transport: {
read: {
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
url: $.common_js.buildUrl("/FilterablePageData/Clients"),
}
},
requestStart: function () {
this.deferred = $.Deferred();
pageFilterPromises.push(this.deferred.promise());
}
},
dataBound: function (e) {
// $(".disabledText").parent().click(false);
}
}).data("kendoDropDownList");
clients.dataSource.bind("change", function () {
this.deferred.resolve();
});
});
</script>
I can also confirm that we have a server response, because I can see it in the Network tab of the browser:
[
{
"disabled": false,
"selected": false,
"text": "All",
"value": "_All"
},
{
"disabled": false,
"selected": false,
"text": "A",
"value": "A"
}
}