是这样的,有一个列表页面,点列表中的一条信息就会弹出一个修改这条信息的对话框,可对这条信息修改,现在的效果是点完了修改,然后我就用this.colse();把这个弹出的修改窗口关闭了,可是原来的那个列表页面这条信息并没有刷新,需要手动刷新浏览器,想不用手动刷新怎么弄?

解决方案 »

  1.   

    <script>parent.location.reload();</script>
      

  2.   

    编辑完保存的时候重新绑定数据。
    调用绑定数据的方法。把数据放在UpdataPanel中。
      

  3.   

    好好学习一下Ajax,你问的问题就会很简单了。
      

  4.   

    Ajax不会,我还有那个无刷新省市级联的没解决的,就是因为不会Ajax,先想想这个应该怎么弄?
      

  5.   

    这个就是子窗口刷新父窗口的页面吧,可用window.opener.location.href=window.location.href;这样就可以刷新了吧或者window.opener.location.reload();也行
      

  6.   

    在修改页面 修改成功加上这句话
     Response.Write("<script>parent.location.reload();</script>");
      

  7.   

    省市联动
    在前台页面中加入这段话  
     <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>   --一定不能少 且只能添加一个
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:DropDownList ID="ddl省" runat="server">
                </asp:DropDownList>  -- 放省级的DropDownList
                <asp:DropDownList ID="ddl市" runat="server">
                </asp:DropDownList>-- 放市级的DropDownList        </ContentTemplate>后台绑定方法不变
            </asp:UpdatePanel>
      

  8.   

    如果是JavaScript;
    在this.close();前面加parent.location.reload();这句话试一下吧。
      

  9.   

     Response.Write("<script type=\"text/javascript\"> 
    opener.location.reload();</script>");
      

  10.   

    楼主你的新窗口是 window.open 出来的吗?
    另外你的那个联动的还没解决??
      

  11.   


    次代码写在修改页面的window.close();前面
      

  12.   


    Microsoft JScript 运行时错误: 'opener.location' 为空或不是对象报错了
      

  13.   

        protected void lbtnName_Click(object sender, EventArgs e)
        {
            int businessAreaId = Convert.ToInt32(((LinkButton)sender).ToolTip);
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenBusinessAreaMaintainWindow", "<script language=javascript>window.showModalDialog('BusinessAreaMaintain.aspx?UserId=" + this.UserId + "&BusinessAreaId=" + businessAreaId + "', window, 'dialogWidth=500px;dialogHeight=500px;status=no;scroll=no;resizable=no;');</script>");
            //Response.Redirect(Request.Url.ToString());
        }
    这个是弹出这个修改页面的后台代码
      

  14.   

     你不是 单独运行这个页面的吧要从你的列表页面点过来 才行 
    且 弹出的页面 用 window.open()方法打开
      

  15.   

    貌似只是单纯的window.open()打开不行,因为还要传值什么的
      

  16.   

    protected void lbtnName_Click(object sender, EventArgs e)
      {
      int businessAreaId = Convert.ToInt32(((LinkButton)sender).ToolTip);
      this.Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenBusinessAreaMaintainWindow", "<script language=javascript>window.showModalDialog('BusinessAreaMaintain.aspx?UserId=" + this.UserId + "&BusinessAreaId=" + businessAreaId + "', window, 'dialogWidth=500px;dialogHeight=500px;status=no;scroll=no;resizable=no;');window.opener.location.reload();</script>");
      
      }改成上面的试试
      

  17.   

     this.Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenBusinessAreaMaintainWindow", "<script language=javascript>window.showModalDialog('BusinessAreaMaintain.aspx?UserId=" + this.UserId + "&BusinessAreaId=" + businessAreaId + "', window, 'dialogWidth=500px;dialogHeight=500px;status=no;scroll=no;resizable=no;');window.opener.location.reload();</script>");
     
      

  18.   

     貌似只是单纯的window.open()打开不行,因为还要传值什么的  var url = 'aa.aspx?Id='+要传的值;
    window.open(url, " ", "height=550,width=500,status=no,toolbar=no,menubar=no,location=no,resizable=yes,top=200px,left=300px ");你如果在列表页面用一个连接跳到你的修改页面 
    当然会报Microsoft JScript 运行时错误: 'opener.location' 为空或不是对象报错了
      

  19.   

    Page.Response.Write("<script>alert('修改完成');window.opener.location.href=window.opener.location.href;window.close();</script>");放在修改页面的修改按钮 里面。点击后,数据完成后,弹出 修改完成 对话框,点击确定后 刷新父页面。
      

  20.   

    Microsoft JScript 运行时错误: 'window.opener.location' 为空或不是对象报这个错误,不知道该怎么办啊???
      

  21.   

    是因为 你弹出的修改页面根本就不是你那个列表页面的子窗口要用 window.open() 方法 弹出你的修改页面
      

  22.   

    "修改这条信息的对话框"这个对话框, 必须以子页面的形式打开,即用window.open来打开对话框的这个页面
    然后在关闭这个子页面时,执行如下一句js
    window.opener.location.href=window.opener.location.href;
      

  23.   

    用超链接做个简单的DEMO:A页面:
    <a href='#' onclick="javascript:var=window.open('B页面.aspx?id=参数',null,'width=600,height=300')">修改</a>B页面:
    在<head></head>中间加上这个<base target="_self" />
    还有这个
    <script language="javascript" type="text/javascript">
            function reshow()
            {
                window.opener.location.reload();
            }
    </script>然后在<body>中加上这个:
    <body onunload="reshow()">------------------------------------------------------------
    这样修改信息后就可以刷新父窗体并且关闭子窗体Response.Write("<script>alert('更新成功!');window.close();</script>");
    希望可以看懂
      

  24.   

    我只到要用window.open(),可是用这个可以传两个值吗??我不知道,我试了,不知道怎么传第二个值,坐等高手
      

  25.   

    额..... 传2个值?
    ?id=参数1&&name=参数2
      

  26.   

    你确定是两个&&而不是一个&吗???
      

  27.   


    //父页面
     function a(id) {
                var v = window.showModalDialog("SqlEdit.aspx?id=" + id + "", "" + id + "", "dialogWidth:450px;dialogHeight:300px;dialogTop:230;center:yes;help:no;status:no;scroll:no;");
                if (v) {
                    refresh();
                }
            }        function refresh() {
                //alert(document.getElementById("flag").value);
                this.location = this.location;
            }//子页面关闭按钮
    <asp:Button ID="btnClose" runat="server" Text="关闭" Width="63px" OnClientClick="window.close()"
                            BorderStyle="Groove" />//子页面提交后台代码

    Response.Write("<script>parent.window.returnValue=true;window.opener=null;window.close();</script>");
      

  28.   

    这位同学 传两个参数id1=X1&id2=X2获取
    Request.QueryString["id1"] id1的值Request.QueryString["id2"] id2的值你还真是要让人送佛送到西啊。。
      

  29.   

    修改页面
    后置代码
     保存事件中
    Response.Redirect("页面");
     
      

  30.   

    不是我知道是这么传递,可是如果用window.open();打开页面的话,根本就传不了两个啊,这样穿获取不到第二个值,也就是你的id2,你试下,id2获取不到,显示为空
      

  31.   

    建议花半小时学习一下AJAX,就能做到无刷新也修改数据了,多了解一些JS也可实现。
      

  32.   

    lz,你该看看ajax,呵呵!!
    lz现在做什么呢??经常能看到你...
      

  33.   

    //刷新父页面,关闭子页面
    function window.onbeforeunload()
    {
    window.opener.location.href = window.opener.location.href; 
    if (window.opener.progressWindow) 

    window.opener.progressWindow.close(); 

    }
    贴出来了,希望对你有用
      

  34.   

    页面里直接弄个
    <script>
    function window.onbeforeunload()
    {
    window.opener.location.href = window.opener.location.href; 
    if (window.opener.progressWindow) 

    window.opener.progressWindow.close(); 

    }
    </script>
    呗,完事,很方便
      

  35.   

    你也可以在子窗体关闭的地方,url跳转到父页面,这样不是就实现刷新的效果了吗
      

  36.   


    protected void lbtnName_Click(object sender, EventArgs e)
      {
      int businessAreaId = Convert.ToInt32(((LinkButton)sender).ToolTip);
      this.Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenBusinessAreaMaintainWindow", "<script language=javascript>window.showModalDialog('BusinessAreaMaintain.aspx?UserId=" + this.UserId + "&BusinessAreaId=" + businessAreaId + "', window, 'dialogWidth=500px;dialogHeight=500px;status=no;scroll=no;resizable=no;');window.location.href=window.location.href;</script>");
      
      }用这个!
      

  37.   

    protected void lbtnName_Click(object sender, EventArgs e)
      {
      int businessAreaId = Convert.ToInt32(((LinkButton)sender).ToolTip);
      this.Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenBusinessAreaMaintainWindow", "<script language=javascript>window.showModalDialog('BusinessAreaMaintain.aspx?UserId=" + this.UserId + "&BusinessAreaId=" + businessAreaId + "', window, 'dialogWidth=500px;dialogHeight=500px;status=no;scroll=no;resizable=no;');window.location.href=window.location.href;</script>");
      
      }
      

  38.   

    Response.Redirect("<script language=javascript>window.location.href=window.location.href;</script>");
    这样肯定行,我遇到过这种情况
      

  39.   

     /// <summary>
        /// 刷新父窗口,关闭当前窗口
        /// </summary>
        /// <param name="url"></param>
        /// <param name="page"></param>
        public static void RefreshParent(string url, Page page)
        {
            string js = @"<Script language='JavaScript'>
                         window.opener.location.href='" + url + "';alert('保存成功!');window.close();</Script>";
            HttpContext.Current.Response.Write(js);
            if (!page.ClientScript.IsStartupScriptRegistered(page.GetType(), "RefreshParent"))
            {
                page.ClientScript.RegisterStartupScript(page.GetType(), "RefreshParent", js);
            }
        }
      

  40.   

      在修改页面放一个BUtton按钮,让其隐藏,在其click事件中重新绑定数据;同时在父页面中修改时激活事件:
      this.clientScript.RegisterClientScriptBlock(this.GetType(),"Edit","alert('修改成功!');window.openner.document.getElementByID('cmdReflesh()').click()",true);
    注:cmdReflesh为Button的ID
      

  41.   

    这样也不行,因为这样还是提示Microsoft JScript 运行时错误: 'window.opener.location' 为空或不是对象
    也就是说必须用window.open();打开吗?要是必须用window.open()打开,那怎么用window.open()传递两个参数???我不知道怎么传递两个参数用window.open(),别和我说是 参数1&参数2 啊
      

  42.   

    this.Response.Write("<script language=javascript>alert('提交成功!');window.close();opener.location.href=opener.location.href;</script>");
    刚才写错了代码了,那个是刷新本页的
      

  43.   

    我的那个父页面不是用window.open()打开的,这样也行吗?
      

  44.   

    ajax好用,有空的时候可以学一下
      

  45.   

    我晕,那个只穿一个参数,我现在要传两个参数呢!!!第二个参数根本就 传不过去!!!
    如果不用这种window.open();的方式可以穿两个,可是这样穿完两个,后面有会报我说的那个错,我都纠结了,我放弃了,不让它往外弹出了,直接跳转
      

  46.   

    哎~我又出来了。你问的这个问题。应该也很少人这么做,一般都只是弹出一个模式div来修改数据的。如果一切操作都在本页面的话,直接重新绑定数据源就可以了。ajax官方示例就有一个弹出模式div的示例。