从asp.net的弹出窗口刷新基本窗口

时间:2013-01-17 07:53:32

标签: c# asp.net

我正在使用以下网址 A 打开一个弹出窗口 B

this.Page.ClientScript.RegisterStartupScript(  
      this.GetType(), 
      "JavaScript", 
     "myWindow=window.open('B.aspx',
     'WindowName',
     'copyhistory=no, 
     width=800, 
     height=300, 
     top=150, 
     left=50, 
     resizable=1, 
     scrollbars=1');
     myWindow.focus();", 
     true
);

每当弹出窗口 B 发生变化时,我想刷新页面 A

2 个答案:

答案 0 :(得分:1)

有很多方法可以做到:

<script>
    window.onunload = refreshParent;
    function refreshParent() {
        window.opener.location.reload();
    }
</script>

<script language="JavaScript">
<!--
function refreshParent() {
  window.opener.location.href = window.opener.location.href;

  if (window.opener.progressWindow)

 {
    window.opener.progressWindow.close()
  }
  window.close();
}
//-->
</script>

来源:

Open popup and refresh parent page on close popup

http://forums.devarticles.com/javascript-development-22/auto-refresh-parent-window-after-closing-popup-4864.html

Refresh parent window when the pop-up window is closed

答案 1 :(得分:0)

refreshParent用户操作调用为:

function refreshParent() {
     window.opener.location.href = window.opener.location.href;
}