I am opening a kendo.window containing a partial view. When I click OK, I want to save my modified data, close the window and reload the base page. For some reason, it doesn't work. It opens the partial view as a full page.
How can I fix this? What should I make my partial view return for it not to open as a page?
Thanks,
Here is what I have so far.
Base page:
<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>
Partial view:
<%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>
<%} %>
Controller
[HttpPost]
public PartialViewResult BadgePicture(string[] hdnBadgeId, HttpPostedFileWrapper Image1)
{
//Do some work with the data
return PartialView(model);
}
UPDATE: My solution
Replace modal: true,
by iframe: true,
with content: "/Home/BadgePicture/" + id,
and use a View instead of PartialView. To close the window on submit: Close Window from within External Content