如题,该页面是一个内容页<asp:Content>XXXXXXXX
我用JS show一个模态窗体,然后判断返回值,确定代码走到window.location =location; 这一句
页面就是不刷新,是什么情况?其他页面都能正常刷新。求解答,各种可能造成该原因的情况例举出来都有分~

解决方案 »

  1.   

    var url =location.href;
     if(url.indexOf('?')>0){
                  url+=("&t="+Math.random());
            }else{
                 url+=("?t="+Math.random());
            }
    window.location =url;
      

  2.   

    你先把判断去掉呢?
    showModalDialog(xxxx)
    window.location =location
      

  3.   

    "window.location.href"、"location.href" 是本页面跳转"parent.location.href"是上一层页面跳转"top.location.href"是最外层的页面跳转举例说明:如果A,B,C,D都是jsp,D是C的iframe,C是B的 iframe,B是A的iframe,如果D中js这样写"window.location.href"、"location.href":D 页面跳转"parent.location.href":C页面跳转"top.location.href":A页面跳转如果D页面中有form的话,<form>: form提交后D页面跳转<form target="_blank">: form提交后弹出新页面<form target="_parent">: form提交后C页面跳转<form target="_top"> : form提交后A页面跳转  关于页面刷新,D 页面中这样写: "parent.location.reload();": C页面刷新 (当然,也可以使用子窗口的 opener 对象来获得父窗口的对象:window.opener.document.location.reload(); )  "top.location.reload();": A页面刷新
      

  4.   


    <%@ Page Title="" Language="C#" MasterPageFile="~/Master/Main.Master" AutoEventWireup="true"
        CodeBehind="XXX.aspx.cs" Inherits="XXXX" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="Content" runat="server">js:
      function ApplyTech(PatentID, PTCheckID, PageType) {
                var result = window.showModalDialog("../Patent/ApplyTechNotes.aspx?PatentID=" + PatentID + "&PTCheckID=" + PTCheckID + "&PageType=" + PageType + "&Rnd=" + Math.random() + "&type=Agree", '', "dialogwidth=700px;dialogheight=300px;");
                if (typeof (result) != "undefined") {
                    if (result == "OK") {
                        alert("操作成功!");
                        window.location = window.location;
                        //document.getElementById("ctl00_Content_btnRefresh").click();//此处调用后台刷新gridview按钮事件,也不刷新
                    }
                }
            }
      

  5.   


    确定走window.location =location
    这一句
    上面我贴了代码,弹出“操作成功!”的提示
      

  6.   

    alert("操作成功!");
    弹出来了吗?
    你可以采用#2楼的方法加随机数
      

  7.   

    window.location.href= ="XX.aspx?" + Date.parse(new Date());
    测试下
      

  8.   

    可能你的页面执行顺序有问题,showModalDialog提交的数据还没有来得及更新你就执行了reload
      

  9.   


    会有这种问题吗?
    try
                {
                    nPTCheckID = Convert.ToInt32(StringOperate.GetQueryString("PTCheckID", "0"));
                    nPatentID = Convert.ToInt32(StringOperate.GetQueryString("PatentID", "0"));
                    string sPageType = StringOperate.GetQueryString("PageType", "");
                    if (!(this.ckbIfSend.Checked == false && sPageType == "R"))
                    {
                        new PatentCheckManager().SubmitTechNotes(nPTCheckID, Convert.ToInt32(new PatentCheckManager().GetSingle(nPTCheckID).n_RoleID), nPatentID);
                    }
                    //保存文件
                    int nFileID = SaveAddFileInfo();
                    //保存操作信息
                    SaveNote(nFileID);                Response.Write("<script>window.returnValue='OK';window.close()</script>");
                }
                catch (Exception ex)
                {
                    Response.Write("<script>window.returnValue='Wrong';window.close();</script>");
                }
    这是模态窗体中返回代码,是在所有操作完了才returnValue的啊
      

  10.   


    第一次发现这个问题的时候,就改用reload()了,不刷新的,谢谢~
      

  11.   

    那就说明你窗口句柄不对
    你确定是window?而不是iframe的窗口名?还有比如window.parent,比如popup窗口操作的时候必须加parent