如何刷新父窗口并关闭子窗口 [英] How to refresh a parent window and close the child window
本文介绍了如何刷新父窗口并关闭子窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在子窗口中有按钮。刷新父窗口并在按钮点击时关闭子窗口。
请帮助
我尝试过:
I have button in child window.how to refresh a parent window and close the child window on button click.
please help
What I have tried:
protected void OpenWindow(object sender, EventArgs e)
{
string url = "Dailywork.aspx";
string s = "window.open('" + url + "', 'popup_window', 'width=800,height=500,left=100,top=100,resizable=yes');";
ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);
}
<asp:RadioButton ID="RadioButton1" runat="server" style="font-weight: 700; font-size: x-large; font-family: Aparajita;"
Text="Today's Updation" AutoPostBack="True"
oncheckedchanged="OpenWindow" />
推荐答案
试试这个
父页面
try this
Parent Page
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script>
var winchild;
function openpop() {
winchild = window.open("popuppage.aspx", "", "width=200,height=100");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<button onclick="openpop()">open popup</button>
</form>
</body>
</html>
儿童页面
Child Page
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script>
function closepopupandrefreshparent() {
window.opener.location.reload();
this.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<button onclick="closepopupandrefreshparent()">close popup</button>
</div>
</form>
</body>
</html>
这篇关于如何刷新父窗口并关闭子窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文