【问题标题】:How to close kendo window through jquery onsucess on button click如何通过 jquery onsuccess onsuccess on button click 关闭剑道窗口
【发布时间】:2014-02-01 04:57:02
【问题描述】:

我有这个附件栏

 columns.Command(command => command.Custom("Attachments").Click("showAttachments")).Width(100).Title("Attachments");

还有我的剑道窗口

  @(Html.Kendo().Window().Name("Attachments")
.Title("Upload Attachments")
.Visible(false)
.Modal(true)
.Draggable(true)
.Width(350)

)

<script type="text/x-kendo-template" id="attachment">
 <a data-role="button" onclick="myFunction();" class='k-button'>Upload</a>

按钮点击

<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();
         },
        })
    };

这里是调用显示附件函数时打开窗口的代码

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/>

这里我想在上传成功时关闭 kendowindow

【问题讨论】:

    标签: jquery asp.net-mvc-4 kendo-ui kendo-window


    【解决方案1】:

    我通过这个 .kendo 窗口将关闭并显示警报消息

     $.ajax({
             type: "POST",
             url: '/Asset/SaveImages',
             data: { imagepath: imagepath, assetid: assetid },
             error: function () {
                 $("#Images").data("kendoWindow").close();
                 alert('Images uploaded Sucessfully');
             }
         })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-08
      • 2010-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-13
      相关资源
      最近更新 更多