单击telerik图像按钮关闭弹出窗口

时间:2013-09-05 20:30:13

标签: javascript mvvm popup window

我有一个弹出控件 - 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;
}

0 个答案:

没有答案
相关问题