三个页面,list.aspx 显示datagrid 显示记录,有一个隐藏起来的控件btn_Fresh,用于被子窗口调用来刷新页面
点编辑 后 弹出编辑子窗口 edit.aspx ,有 确定 和 关闭 按钮
点 确定 的按钮代码 是 onclick="return funAdd();"
javascript代码这样实现
function funAdd()
{
document.all.btOK.click();
if(window.confirm("是否有*****?"))
{
   window.open("three.aspx");
   window.close() ;
}
else
{
   window.opener.document.getElementById('btn_Fresh').click();
   window.opener = null ;
   window.close() ;
}在three.aspx 同样有 确定 和 关闭 按钮
点击 确定 按钮后 运行代码 后

Me.Response.Write("<script languge=javascript>window.opener.document.getElementById('btn_Fresh').click();</script>")
Page.Response.Write("<script>window.opener=null;window.close()</script>")来刷新 list.aspx 没反应,大家有谁知道的帮解答下,谢谢了!

解决方案 »

  1.   


    对你的需求还不太理解 window.confirm 弹出的你可以考虑用 弹出窗口的返回值来判断是否刷新父窗口
      

  2.   


    点击 确定 按钮后 运行如下代码
    script = "var obj=window.opener;if(obj!=null){obj.document.getElementById('btn_Fresh').click();obj.close(); }
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", script, true);
      

  3.   

    javascript 是找不到被隐藏的服务器控件的
    你用
    alert(window.opener.document.getElementById('btn_Fresh'));
    看看
      

  4.   

    是找不到 那个控件的了,alert(window.opener);就显示Object。
    现在 改了一些 ,
    if(window.confirm("是否有财务预测?"))
    {
    self.location.href = "FinaData.aspx" ;
    //self.location.replace("FinaData.aspx") ;
    //window.location = "FinaData.aspx" ;

    三句 代码用其中 的一句或者 在 edit.aspx  添加 一个<asp:button ID="btn_Redirect" Runat="server" Height="1px" Width="1px" Text="重定向">后台代码 click 为
    Me.Response.Redirect("FinaData.aspx")然后 
    if(window.confirm("是否有财务预测?"))
    {
       document.all.btn_Redirect.click();
    } 可以刷新 list.aspx 了,但是有时候 刷新 不太正常 ,在three.aspx更新了一些数据,list.aspx 还是没刷新得出来,大家再帮看看吧!