如何刷新弹出窗口的关闭父页面 [英] How to refresh parent page on closing of Pop Up Window

查看:126
本文介绍了如何刷新弹出窗口的关闭父页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个ASPX页面。在第一页我显示从数据库和我显示为弹出窗口,用户可以看到另一个GridView和他们可以通过此页面添加成员在第二页上值网格。他们从弹出窗口并关闭添加成员后,那么我的要求是,这样的电网重新加载在其GridView中新增加的成员刷新第一页。任何人都可以帮助我在这?我想这下code,但这并没有帮助:

I have two ASPX pages. In first page I am showing the Grid with values from database and on the second page I am showing as pop-up window where user can see another gridview and they can add member from this page. After they add member from Pop-Up window and close then my requirement is to refresh the first page so that its grid reloads the new added members on its gridview. Can anyone help me on this? I am trying this following code but this is not helping:

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

        if (window.opener.progressWindow) {
            window.opener.progressWindow.close()
        }
        window.close();
    }

  <body onunload="refreshparent();">

和另一个问题是我使用弹出窗口中多了一个服务器端的按钮,只要按钮pressed的窗口关闭,刷新父页面。但我想弹出由用户输入被关闭。

And another problem is as I am using one more server side button on pop-up window so whenever the button is pressed the window closes and refresh the parent page. But i want the pop-up to be closed by the user input.

您的帮助会这么AP preciable。

Your help would be so appreciable.

感谢

推荐答案

您可以通过下面code继续:

You can go ahead with below code:

父页

HTML

<script type="text/javascript">
    function OpenPopup() {
        window.open('ChildPopupWindows.aspx', '', 'width=200,height=100');            
    };
</script>

<input type="button" value="Open popup" onclick="javascript: return OpenPopup()" />

儿童页

HTML

<script type="text/javascript">
    function CloseWindow() {
        window.close();
        window.opener.location.reload();
    }
</script>

<asp:Button ID="btnServer" runat="server" OnClick="btnServer_Click" Text="Request server" />
    <br />        
    <input type="button" value="Close Window" onclick="javascript: return CloseWindow();" />

C#

protected void btnServer_Click(object sender, EventArgs e)
    {

    }

说明

Explanation

当你点击请求服务器按钮,服务器回传将发生,而你的子窗口不会被关闭。

When you click "Request Server" button, server postback will take place whereas your child window will not be closed.

当你点击关闭窗口按钮,你的孩子窗口将关闭,这也将刷新父页面。

Your child window will be closed when you click "Close Window" button, this will also refresh your parent page.

查询欢迎...

这篇关于如何刷新弹出窗口的关闭父页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆