首页 文章

使用Internet Explorer更新Kendo DropDownList

提问于
浏览
2

我有一个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进行测试 .

有帮助吗?

Edit

这是生成的Javascript代码:

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

1 回答

  • 4

    我找到了一个解决方案,我发布了它,以帮助其他可能遇到同样问题的人 .

    我现在有

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

    代替

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

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

相关问题