我有两个页面a.aspx和b。aspx。在a页面上用一个gridview来显示数据库中对应条件的查询内容,点击gridview中的一行时,会弹出b页面(b页面时a中gridview每行的详细信息),在b页面的下方有个确定(ok)按钮,点击按钮后就会将这条信息在数据库中的“未处理”变成“已处理”,同时关闭b页面。但是我不知道怎么样在关闭b页面的同时把a页面刷新一下。如果不刷新a,那a中还是显示未出里的状态。分不多了,谁能帮我解决这个问题啊?谢谢了

解决方案 »

  1.   

    我的就是点击按钮啊,在button的事件里执行更新操作,刷新操作和关闭当前页面操作,现在就是刷新操作不会。
      

  2.   

    window.open打开的使用window.opener.location.href=window.opener.location.href
    showModalDialog打开的,使用window.dialogArguments.location.href=window.dialogArguments.location.href更加兼容的方法,参见详细的代码
    例子
    a.aspx<input type="button" onclick="window.showModalDialog('c.aspx',window)" value="打开窗口" />c.aspx<%@ Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
      <title></title>
    </head><frameset cols="0,*">
    <frame src=""></frame>
    <frame src="b.aspx?tmp=<%=System.Guid.NewGuid().ToString() %>"></frame>
    </frameset>
    </html>
    b.aspx
    <%@ Page Language="C#" EnableViewState="true" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">  
       
      protected void Button2_Click(object sender, EventArgs e)
      {
      Response.Write("xxx");
      }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
      <title></title>
    </head>
    <body>
      <form id="form1" runat="server">
      <asp:Button ID="Button2" runat="server" Text="Button" onclick="Button2_Click" />
      <asp:Button ID="Button1" runat="server" Text="关闭" OnClientClick="window.top.dialogArguments.location.href='a.aspx?cmd=' + Date.parse(new Date());top.close();return false;" />
      </form>
    </body>
    </html>
      

  3.   

    父窗口将window对象作为参数传入
    s= showModalDialog("", self, '');
    子窗口
    win = window.dialogArguments;
    win.document.getElementById("");
    document.getElementById(" <%=Button2.ClientID%>").click(0重新绑定gridview
      

  4.   

    大不了你把B页面放在框架中
    刷新及关闭
    (例如:调用父页面函数refresh())
    window.opener.refresh();window.close();
      

  5.   

    还有好方法吗?我的b页面知识弹出来显示详细信息,并更改信息,a页面一直处于打开状态,在b页面关闭的时候怎样去刷新a页面,这是我想要的,麻烦给我再帮帮忙。
      

  6.   

    写在子窗口的 onbeforeunload 事件里,即使点 X,也有效
      

  7.   

    我用了,没有效果,最终找到了C#的代码,分享一下了,他可以实现我想要的功能。
     this.Response.Write("<script>window.opener.location.href=window.opener.location.href;window.close();</script>");
            this.Response.Write("<script>window.opener.location.replace(window.opener.document.referrer);window.close();</script>"); 
      

  8.   

    你可以这样,将B页面做成一个弹出页面,在做完B页面的操作以后,让他自动跳转到a页面,这样的话,a页面不就会重新加载