1

我有一个弹出控件-Test.ascx,需要在其“取消”按钮单击操作时将其关闭。这是代码。

标记:

 < TelerikButtons:TelerikImageButton ID="btnCancel" runat="server" Text="Cancel" ButtonType="Cancel" />

后面的代码:

 btnCancel.MvvmSetup(controlBinder, model => model.CancelPopup());

视图模型:

public void CancelPopup()
{
    var page = HttpContext.Current.Handler as Page;
    if (page != null) ScriptManager.RegisterStartupScript(page, page.GetType(), "err_msg", "Close();", true);
}

JS:

 function GetPopupWindow() {

    var myWindow = null;

    if (window.getElementById("btnCancel").click) 
        myWindow = window.getElementById("btnCancel").click;
    return myWindow;
}

function Close() {
    var myWindow = GetPopupWindow();
    myWindow.argument = null;
    myWindow.close();
    return false;
}
4

0 回答 0