Javascript 提交后无法重新加载弹出窗口
我使用剑道窗口创建新记录,并在此窗口中呈现局部视图。虽然我可以将表单数据发布到控制器,但当出现错误并需要返回剑道窗口时,我无法返回表单。任何帮助都将不胜感激 查看:Javascript 提交后无法重新加载弹出窗口,javascript,asp.net-mvc,kendo-ui,kendo-asp.net-mvc,kendo-window,Javascript,Asp.net Mvc,Kendo Ui,Kendo Asp.net Mvc,Kendo Window,我使用剑道窗口创建新记录,并在此窗口中呈现局部视图。虽然我可以将表单数据发布到控制器,但当出现错误并需要返回剑道窗口时,我无法返回表单。任何帮助都将不胜感激 查看: // I call this method on ButtonClick function openWindow(win) { var window = $(win).data("kendoWindow"); window.refresh(); window.center();
// I call this method on ButtonClick
function openWindow(win) {
var window = $(win).data("kendoWindow");
window.refresh();
window.center();
window.open();
};
@(Html.Kendo().Window()
.Name("winCreate")
.Title("Create")
.Visible(false)
.Draggable(true)
.LoadContentFrom("_Create", "Issue")
.Modal(true)
.Actions(actions => actions
.Close()
)
)
//I tried to recall Kendo Window as below, but it cannot be rendered:
return PartialView("_Create", "Issue", issueViewModel);
控制器:
// I call this method on ButtonClick
function openWindow(win) {
var window = $(win).data("kendoWindow");
window.refresh();
window.center();
window.open();
};
@(Html.Kendo().Window()
.Name("winCreate")
.Title("Create")
.Visible(false)
.Draggable(true)
.LoadContentFrom("_Create", "Issue")
.Modal(true)
.Actions(actions => actions
.Close()
)
)
//I tried to recall Kendo Window as below, but it cannot be rendered:
return PartialView("_Create", "Issue", issueViewModel);
是否还有其他人使用弹出窗口在MVC中创建新记录(使用ajax提交表单并在收到响应错误时处理错误。您不需要重新加载弹出窗口,只需将错误消息从控制器显示到弹出窗口页面中的某个元素。您的错误是您没有在此处进行ajax调用,您正在执行正常的
HTTP。将请求发送到控制器并返回不同的视图。相反,您可以当你点击弹出页面中的“提交”
按钮时,你应该向你的控制器发出ajax
请求。请查看此按钮的答案,它将帮助你在弹出页面中执行ajax提交表单。