现在有这样一个需求,在一个页面有一个button和一个GridView,我需要点击button时打开另一个页面,在页面上添加一些信息,然后点击确定,这时要关闭后来打开的页面并刷新第一个页面,请问我需要怎么做~~~~~~~
希望大家帮我一下,谢谢了~~~~~~

解决方案 »

  1.   

    opener.window.document.location.relod();
    or
    opener.window.document.location.href=opener.window.document.location.href;
      

  2.   

    a页面 button点击后
    string script="<script language='javascript'>window.showModalDialog('b.aspx');window.location.replace('a.aspx');</script>";if (!ClientScript.IsStartupScriptRegistered("showModal"))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "showModal", script);
            }
      

  3.   

    在Button上添加一个js:在Page_Load里加上
    this.btnAdd.Attributes.Add("onclick", "return Add()");
    前台:function Add()
            {
                var strUrl = "Edit.aspx?&sno=" + sno;//所传递参数
                var ret = window.showModalDialog(strUrl,'',"dialogWidth=350px;dialogHeight=200px;center=1;scroll=0");  
                if(ret == null)
                {
                    return false;
                }
             
            }
    再在protected void Button_Click(object sender, EventArgs e)
        {    }
    里重新绑定数据
    在新页面的“确定”
    protected void Button_Click(object sender, EventArgs e)
        {
            Response.Write("<script language=javascript>window.returnValue=true; window.close();</script>");
        }
    大致就是这样了
    还有一种方法,就是reload,如果需要再说明
      

  4.   

    点button打开个新页应该没问题吧,新页的确定按钮最后加上
    Response.Write("<script>opener.window.document.location.href=opener.window.document.location.href;opener=null;window.close();</script>");
    最好中间用一个框加页过渡一下,不然关掉新页后有会自动打开,关不掉新页;
    过渡页html代码如:
    <HTML>
    <HEAD>
    <TITLE>commonPage</TITLE>
    <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <frameset rows="0,*">
    <frame src="about:blank">
    <frame src="新页">
    </frameset>
    </HTML>