check_ws.aspx页面里的gridview 的HyperLink1 弹出页面check_a.aspx
 string aurl = "javascript:varwin=window.showModalDialog('check_a.aspx?djh={0}',null,'dialogWidth=800px,dialogHeight=900px ');";在check_a.aspx页面进行审核button操作后,自动关闭页面,check_ws.aspx页面没有更新!
怎样才能关闭弹出页面并更新原页面内容??
我在check_a.aspx的button动作protected void bt_bzadd_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                name = Session["ryxm"].ToString();
                QhmxModel qhmxmodel = new QhmxModel();
                qhmxmodel.djh = this.Lab_number.Text.Trim();
                qhmxmodel.ryxm = name.Trim();
                qhmxmodel.qhyjbc = this.txt_qhbz.Text.Trim();
                QhmxBLL qhmxbll = new QhmxBLL();
                qhmxbll.Update_qhyjbc(qhmxmodel);
                Response.Write("<script>alert('备注添加成功!')</script>");
                Bindqhmx();
                HttpContext.Current.Response.Write(" <script> window.opener.location.reload(); </script> ");
                Response.Write("<script>window.close();</script>");
            }
        }

解决方案 »

  1.   

    varwin=window.showModalDialog('check_a.aspx?djh={0}',null,'dialogWidth=800px,dialogHeight=900px ');
    后面加一句window.location.href = window.location.href;
      

  2.   

    我照着这样做了,不行
    string aurl = "javascript:varwin=window.showModalDialog('check_a.aspx?djh={0}',null,'dialogWidth=800px,dialogHeight=900px,window.location.href = window.location.href);');";
      

  3.   

    window.parent.opener.location.reload();
      

  4.   

      Response.Write("<script>window.close();window.parent.opener.location.reload();</script>");
    这样试试
      

  5.   

    就是替换 Response.Write("<script>window.close();</script>");这句呀
      

  6.   

    HttpContext.Current.Response.Write(" <script> window.opener.location.reload(); </script> ");
                    Response.Write("<script>window.close();</script>");
    把第一句删了   第一句已经重新加载当前页面了  后台的代码可能根本没得到执行
      

  7.   

    check_ys.aspx 页面 弹出窗口代码protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
     string djh = GridView1.DataKeys[e.Row.RowIndex].Value.ToString();
      HyperLink link = (HyperLink)e.Row.FindControl("HyperLink1");
      string aurl = "javascript:varwin=window.showModalDialog('check_a.aspx?djh={0}',null,'dialogWidth=800px,dialogHeight=900px,window.location.href = window.location.href ');";
     //取列申请书种类的字段值
       switch (e.Row.Cells[4].Text)
       {
        case "申请书":
        //link.NavigateUrl = string.Format("check_a.aspx?djh={0}", djh);
          link.NavigateUrl = string.Format(aurl, djh);
        break;
          case "票务证件":
       link.NavigateUrl = string.Format("check_b.aspx?djh={0}", djh);
        break;
       case "住宿":  ...   break;
                    }
     }
    }check_a.aspx 页button事件
     protected void bt_bzadd_Click(object sender, EventArgs e)
    {
       if (Page.IsValid)
          {
           name = Session["ryxm"].ToString();
           QhmxModel qhmxmodel = new QhmxModel();
           qhmxmodel.djh = this.Lab_number.Text.Trim();
           qhmxmodel.ryxm = name.Trim();
           qhmxmodel.qhyjbc = this.txt_qhbz.Text.Trim();
           QhmxBLL qhmxbll = new QhmxBLL();
           qhmxbll.Update_qhyjbc(qhmxmodel);
           Response.Write("<script>alert('备注添加成功!')</script>");
            Bindqhmx();
           Response.Write("<script>window.close();window.parent.opener.location.reload();</script>");
           //Response.Write("<script>window.close();</script>");
                }
            }
    谁能帮我改下代码?
    我改了后就是不刷新没有更新!!
      

  8.   

    Response.Write("<script>window.close();window.location.href='check_ys.aspx'</script>");
     
      

  9.   

    http://sd8089730.javaeye.com/blog/855825用js吧
      

  10.   


    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>无标题页</title>
        <script type="text/javascript">
            function sopen(){
               var str = window.showModalDialog('Default.aspx',null,'dialogWidth=300px;dialogHeight=300px');
               if(str!=null&&str=="yes")
                window.location.reload();
            }
        </script>
    </head>
    <body>
    <a onclick="sopen()">打开</a>
    <span id="time"></span>
    <script type="text/javascript">
        var date = new Date();
        document.getElementById("time").innerHTML=date.getMinutes()+"=="+date.getSeconds();
    </script>
    </body>
    </html>
    <!--Default.aspx页面-->
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>无标题页</title>
    </head>
    <base target="_self" />
    <body style="margin:0px;padding:0px;">
        <form id="form1" runat="server">
        <div>
            <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
        </div>
        </form>
    </body>
    </html>    protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Write("<script>window.close();window.returnValue='yes'</script>");
        }
      

  11.   

    以上代码ie ff都测试成功 当前秒数有刷新
      

  12.   

    var sReturn=window.showModalDialog("" + id,'','dialogWidth:420px;dialogHeight:570px,center=yes,status=no,resizable=no,scroll=no,dialogHide=on');;
      在子页面
    function reload()
     {
      window.close();
      }加入 <base target="_self"/>   

    window.dialogArguments.window.location = window.dialogArguments.window.location; self.close();session记录页数或传值
    也可使用
      

  13.   

    window.opener.location.href=window.opener.location.href;
      

  14.   

    如果是需要执行按钮查询,才可以看到新窗口操作变化,可使用以下方法this.Page.RegisterClientScriptBlock("Return", "<script>window.opener.document.Form1.BtnSearch.click();window.close();</script>");
      

  15.   

    后面加,if(sReturn='ok'){location.href('返回的页面.aspx')}