C# 如何在按下按钮时关闭弹出窗口,并在打开弹出窗口时启动回发?
请参见上文…尝试以下方法:C# 如何在按下按钮时关闭弹出窗口,并在打开弹出窗口时启动回发?,c#,asp.net,javascript,C#,Asp.net,Javascript,请参见上文…尝试以下方法: parent.document.getElementById('btnSubmit').click();; // submit the parent form self.close(); // close the current window 试着这样做: parent.document.getElementById('btnSubmit').click();; // submit the parent form self.close(); // close the
parent.document.getElementById('btnSubmit').click();; // submit the parent form
self.close(); // close the current window
试着这样做:
parent.document.getElementById('btnSubmit').click();; // submit the parent form
self.close(); // close the current window
您应该能够在window.parent中调用函数
<script type="text/javascript">
function closeThisPopupWindow()
{
if (window.parent && window.parent.callBack)
window.parent.callBack();
window.close();
}
</script>
函数closeThisPopupWindow()
{
if(window.parent&&window.parent.callBack)
window.parent.callBack();
window.close();
}
显然,您需要将closeThisPopupWindow函数附加到按钮上。您应该能够在window.parent中调用函数
<script type="text/javascript">
function closeThisPopupWindow()
{
if (window.parent && window.parent.callBack)
window.parent.callBack();
window.close();
}
</script>
函数closeThisPopupWindow()
{
if(window.parent&&window.parent.callBack)
window.parent.callBack();
window.close();
}
显然,您需要将closeThisPopupWindow功能附加到按钮上。我会在弹出窗口的按钮单击中执行类似操作
ClientScript.RegisterStartupScript(typeof(string), "auto_refreshparent", @" window.opener.location.reload(); ", true);
ClientScript.RegisterStartupScript(typeof(Page), "ThatsAllFolks", "window.close();", true);
我会这样做,在按钮点击弹出窗口
ClientScript.RegisterStartupScript(typeof(string), "auto_refreshparent", @" window.opener.location.reload(); ", true);
ClientScript.RegisterStartupScript(typeof(Page), "ThatsAllFolks", "window.close();", true);
string windowArgs=“工具栏=否,菜单栏=否,位置=否,宽度=620,高度=500,滚动条=是,可调整大小=是,模式=是”;
字符串newWindowUrl=“MarketShotPreview.aspx”;
字符串javaScript=
“\n”+
“\n”+
“\n”;
RegisterStartupScript(typeof(System.Web.UI.Page),“Popup”,javaScript) string windowArgs=“工具栏=否,菜单栏=否,位置=否,宽度=620,高度=500,滚动条=是,可调整大小=是,模式=是”;
字符串newWindowUrl=“MarketShotPreview.aspx”;
字符串javaScript=
“\n”+
“\n”+
“\n”;
RegisterStartupScript(typeof(System.Web.UI.Page),“Popup”,javaScript)