【发布时间】:2013-11-05 19:39:28
【问题描述】:
我正在打开一个包含局部视图的 kendo.window。当我单击确定时,我想保存我修改的数据,关闭窗口并重新加载基本页面。由于某种原因,它不起作用。它将部分视图作为整页打开。
我该如何解决这个问题?我应该如何让我的部分视图返回以使其不作为页面打开?
谢谢,
这是我目前所拥有的。
基本页面:
<div id="windowBadgeIMGDiv" class="k-content">
<div id="windowBadgeIMG" style="display:none">
</div>
<script type="text/javascript">
function editDetails(id) {
var windowBadgeIMG = $("#windowBadgeIMG");
windowBadgeIMG.kendoWindow({
modal: true,
width: "950px",
title: "Modify badge picture",
content: {
url: "/Home/BadgePicture",
data: { id: id }
},
deactivate: function () {
}
});
windowBadgeIMG.data("kendoWindow").center();
windowBadgeIMG.closest(".k-window").css({ top: 100 });
windowBadgeIMG.data("kendoWindow").open();
}
</script>
局部视图:
<%using (Html.BeginForm("BadgePicture", "Home", FormMethod.Post, new { enctype = "multipart/form-data", id = "ImgForm", name = "ImgForm" }))
{ %>
<input type="hidden" name="hdnBadgeId" id="hdnBadgeId" value="<%= Model.Id%>" />
<table>
<!--My editable fields go here-->
<tr>
<td style="padding-top: 20px;" align="center" colspan="4">
<button id="btnSubmit" type="submit"><asp:Label runat="server" Text="<%$ Resources:Global, Update %>" /></button>
</td>
</tr>
</table>
<%} %>
控制器
[HttpPost]
public PartialViewResult BadgePicture(string[] hdnBadgeId, HttpPostedFileWrapper Image1)
{
//Do some work with the data
return PartialView(model);
}
更新:我的解决方案
将modal: true, 替换为iframe: true, 为content: "/Home/BadgePicture/" + id,,并使用视图而不是PartialView。关闭提交窗口:Close Window from within External Content
【问题讨论】:
-
您应该将您的答案作为答案发布,并接受它!现在,您的解决方案在您的问题中丢失了,并且接受的答案实际上并不能解决您的问题。
标签: asp.net-mvc kendo-ui window submit