1. 母页
前台代码:
//根据返回值确定是否刷新页面
var retval = window.showModalDialog(url, null, 'dialogWidth=680px;dialogHeight=620px; help:no; status:no');
if (retval != undefined) {
__doPostBack('__refresh', '');
}
后台代码:(后台返回刷新)
string target = Request.Form["__EVENTTARGET"].ToString();// 自定义的PostBack事件if (target == "__refresh"){//更新新的数据}
2. 模式对话框内的页面:
前台:
<!-- 防止重新打开页面形式的对话框 -->
<base target="_self"/>
后台:
//清除缓存数据
Context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
//关闭窗口后,设置窗口返回值
Response.Write("<script language='javascript'>");
Response.Write("window.returnValue=1;");
Response.Write("window.close();");
Response.Write("</script>");