当前位置:编程学习 > C#/ASP.NET >>

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教程,基础入门 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,