Reputation: 207
I have this attachments column
columns.Command(command => command.Custom("Attachments").Click("showAttachments")).Width(100).Title("Attachments");
and my kendowindow
@(Html.Kendo().Window().Name("Attachments")
.Title("Upload Attachments")
.Visible(false)
.Modal(true)
.Draggable(true)
.Width(350)
)
And
<script type="text/x-kendo-template" id="attachment">
<a data-role="button" onclick="myFunction();" class='k-button'>Upload</a>
button onclick
<script type="text/javascript">
function myFunction() {
var ln = document.getElementById("NumInput").value;
var fil = document.getElementById("files");
var filepath = fil.value;
var assetid = document.getElementById("hdassetid").value;
$.ajax({
type: "POST",
url: '/Asset/SaveAssetAttachments',
data: { filename: ln, filepath: filepath, assetid: assetid },
success: function (data) {
$("#myWindow").data("kendoWindow").close();
},
})
};
and here is code for opening window when show Attacments function called
function showAttachments(e) {
e.preventDefault();
var attachmentTemplate = kendo.template($("#attachment").html());
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var wnd = $("#Attachments").data("kendoWindow");
wnd.content(attachmentTemplate(dataItem));
wnd.center().open();
}
<scrip/>
Here i want to close kendowindow onupload sucess
Upvotes: 1
Views: 7067
Reputation: 207
I got through this .kendo window will close and alert message will display
$.ajax({
type: "POST",
url: '/Asset/SaveImages',
data: { imagepath: imagepath, assetid: assetid },
error: function () {
$("#Images").data("kendoWindow").close();
alert('Images uploaded Sucessfully');
}
})
Upvotes: 1