首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

.net弹出方式窗口,关闭后刷新父窗口

2012-08-02 
.net弹出模式窗口,关闭后刷新父窗口A.aspx 里有个repeater 每行后面有个查看详情的按钮a title查看详细

.net弹出模式窗口,关闭后刷新父窗口
A.aspx 里有个repeater 每行后面有个查看详情的按钮  
 <a title="查看详细信息.." href="#" id='<%#Eval("T_UserID") %>' class="GetMes">
 <img src="Images/LookMes.gif" />
</a>
 点击按钮弹出一个模式窗口GetMoreMes.aspx 我用的showModalDialog

js代码
 

C# code
$(".GetMes").click(function() {        if ($.trim($(this).attr("id")).length > 0) {        window.showModalDialog("GetMoreMes.aspx?UID=" + $(this).attr("id"),"window","dialogwidth:710px;dialogheight:500px;center=yes;resizable:yes;help=no;status=no;");                }    })


GetMoreMes.aspx里一条记录的详细信息 点击保存后关闭子窗口并刷新父窗口 使父窗口数据得到更新

保存事件里调用
C# code
protected void BtnSaveWorkInfo_Click(object sender, EventArgs e)    {        。。。。。。。。。。。。。。。。        。。。。。。。。。。。。。。。。。。。。           StringBuilder scriptString = new StringBuilder();            scriptString.Append("<script language = javascript>");            scriptString.Append(" window.close(); ");            scriptString.Append("</" + "script>");            Response.Write(scriptString.ToString()); }

 如果用window.location.reload() 当A.aspx点击下一页页或者二次提交的时候 每次都会弹出 要再次显示该网页,Internet Explorer 需要重新发送你以前提交的信息
然后又改用location.href = location.href 这样不弹出了 但是关闭后总是回到初始页面了

很苦恼╮(╯▽╰)╭ 求解 求大侠

[解决办法]
location.replace(location.href)
[解决办法]
window.opener.location.reload(); //刷新父页面

window.close();//关闭当前页面

热点排行