Asp.net实用技巧(2)
1. 在Asp.net实用技巧(1) 中提到了如何刷新父页面,那么如果要刷新父页面的父页面的父页面了?那就是刷新祖先页面RefreshAncestorPage。
RefreshAncestorPage#region RefreshAncestorPage
/**//// <summary>
/// 刷新指定的祖先页面,注意是"祖先页面"
/// </summary>
public static void RefreshAncestorPage(HttpResponse Response ,string targetPageTitle ,bool isCloseCurPage)//targetPageTitle 目标页面的title
{
StringBuilder scriptString = new StringBuilder();
scriptString.Append("<script language = javascript>");
scriptString.Append("var p = window ;");
scriptString.Append(string.Format("while(p.document.title != '{0}')" ,targetPageTitle));
scriptString.Append("{");
scriptString.Append("p = p.opener ;");
scriptString.Append("}
补充:asp.net教程,基础入门