使用Internet Explorer更新Kendo DropDownList时出现问题

Issue updating Kendo DropDownList with Internet Explorer

本文关键字:问题 DropDownList Kendo Internet Explorer 更新 使用      更新时间:2023-09-26

我有一个Kendo DropDownList,我想通过javascript函数更新/刷新它。使用FireFox和Chrome,它运行良好,但使用Internet Explorer,它不会更新任何内容。

@(Html.Kendo().DropDownList()
    .Name("myDDL")
    .HtmlAttributes(new { style = "width: 320px" })
    .DataTextField("Description")
    .DataValueField("Id")
    .DataSource(source =>
    {
        source.Read(read =>
        {
            read.Action("fillDDL", "ControllerName");
        });
    })
)

javascript函数:

function refreshForm() {
    $("#myDDL").data("kendoDropDownList").dataSource.read();
}

也勾选了这个问题,但没有运气。

我正在测试Internet Explorer 11。

有什么帮助吗?

编辑

这是生成的Javascript代码:

jQuery(function () {
    jQuery("#myDDL").kendoDropDownList({
        "dataSource": {
             "transport": {
                 "read": {
                     "url": "/ControllerName/fillDDL"
                 },
                 "prefix": ""
             },
             "schema": {
                 "errors": "Errors"
             }
         },
         "dataTextField": "Description",
         "dataValueField": "Id"
     });
});

我找到了一个解决方案,我正在发布它,这样它可以帮助其他可能面临同样问题的人。

现在我有

read.Action("fillDDL", "ControllerName").Type(HttpVerbs.Post);

而不是

read.Action("fillDDL", "ControllerName");

添加这段代码现在可以刷新DropDownList,即使在使用Internet Explorer时也是如此。