使用Internet Explorer更新Kendo DropDownList

时间:2014-10-28 15:55:30

标签: javascript jquery internet-explorer kendo-ui

我有一个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();
}

并检查this question但没有运气。

我正在使用Internet Explorer 11进行测试。

任何帮助?

修改

这是生成的Javascript代码:

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

1 个答案:

答案 0 :(得分:4)

我找到了一个解决方案,并且我发布了该解决方案,以便帮助可能遇到同样问题的其他人。

现在我有了

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

而不是

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

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