从CHILD(带窗口)aspx页面返回后/返回时在MAIN.aspx上执行Page_Load

本文关键字:aspx 返回 MAIN 执行 Load Page 窗口 CHILD | 更新日期: 2023-09-27 18:28:28

虽然我获得了认证,但这是我的第一个真正的程序,所以请耐心回答我的新手问题。我查看了这个论坛和其他论坛,没有找到任何答案。

我有一个MAIN.aspx,从那里我使用启动了一个有窗口的aspx页面

    ClientScript.RegisterStartupScript(typeof(Page), "", 
    "<script type='text/javascript'>window.open        
    ('CHILD.aspx','','width=800,height=400,toolbar=no,location=no,
    directories=no,status=no,menubar=no,scrollbars=yes,
    resizeable=no,copyhistory=no');</script>", false);

此子aspx页面显示一个网格视图,其中包含可以使用"Select"按钮选择的条目列表。选择一个后,用户可以单击退出按钮,返回MAIN. aspx。返回使用以下两行代码执行:

    protected void btnExit_Click(object sender, EventArgs e)
    {
        // this line allows the capture of selected values 
        gvSelection_SelectedIndexChanged(sender, e); 
        ClientScript.RegisterStartupScript(typeof(Page), "", "window.close()", true);
    }

到目前为止,我已经能够验证在返回到MAIN.aspx时,我保存的值是可用的,EXCEPT... Page_Load由于明显的原因不会执行。

我需要关于如何在退出带窗口的ASPX页面时EXECUTE MA IN.ASPX("Page_Load")的帮助。

从CHILD(带窗口)aspx页面返回后/返回时在MAIN.aspx上执行Page_Load

您可以如下更新代码:

protected void btnExit_Click(object sender, EventArgs e)
    {
        // this line allows the capture of selected values 
        gvSelection_SelectedIndexChanged(sender, e); 
        ClientScript.RegisterStartupScript(typeof(Page), "", "window.close();window.opener.location.reload();", true);
    }