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