Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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">
Upload

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
Posted
Comments
Kaushik.Subramanian 27-May-14 8:10am    
var ClosePopup = $("#DivBinding").kendoWindow({
title: "hi",
visible: false,
modal: true
}).data("kendoWindow");
Kaushik.Subramanian 27-May-14 8:10am    
on button click
var ClosePopup = $("#DivBinding").kendoWindow({
title: "hi",
visible: false,
modal: true
}).data("kendoWindow");
$("#Close").on("click", function () {
ClosePopup.close();
});

1 solution

$(document).ready(function () {

Button Click Popup

$('#button').click(function (event) {
var BatchID = $(this).attr("id");
$.ajax({
cache: false,
url: "@(Url.Action("ActionName", "ControllerName"))",
data: { "Batch": BatchID },
success: function (data) {
$("#DivBinding").html(data);
},
error: function (xhr, ajaxOptions, thrownError) {
}
});
$("#DivBinding").kendoWindow({
actions: ["Close"],
draggable: true,
height: "400px",
modal: true,
pinned: false,
position: {
top: 210,
left: 500
},
resizable: false,
title: "Card Locs",
close: function (e) {
$(this.element).empty();
},
width: "1150px",
minWidth: 1150,
maxWidth: 1150
});
$("#DivBinding").data("kendoWindow").open();
return false;
});
});
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900