我有一个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");
现在,即使使用Internet Explorer,添加此代码位也可以刷新DropDownList。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句