,转asp.net的一点代码

1.在新窗口中打开页面 我们经常需要在点击某个Button的时候打开一个新的页面,而且由于应用的需要,我们又不能使用超级连接或者LinkButton来代替这个Button,于是我们只有在Button的Click事件中进行新页面的打开工作。我将这个工作封装成一个API,如下: 1OpenWindowInNewPage#region OpenWindowInNewPage 2 //在新窗口中打开页面 3 public static void OpenWindowInNewPage(Page curPage ,string destUrl) 4 { 5 string scriptString = string.Format(" " ); 26 if ( ! page.IsStartupScriptRegistered( scriptName ) ) 27 { 28 page.RegisterStartupScript( scriptName, StrScript.ToString() ); 29 } 30 } 31 #endregion 3.还有一种情况就是我们需要在关闭当前页面时,刷新当前页面的“父页面”,所谓“父页面”,就是Post本页面之前的一个页面。可以调用如下API: RefreshFatherPage#region RefreshFatherPage //刷新Father页面 public static void RefreshFatherPage(HttpResponse Response ,bool isCloseCurPage) { StringBuilder scriptString = new StringBuilder(); scriptString.Append(" */ #endregion 1. 在Asp.net实用技巧(1) 中提到了如何刷新父页面,那么如果要刷新父页面的父页面的父页面了?那就是刷新祖先页面RefreshAncestorPage。 RefreshAncestorPage#region RefreshAncestorPage /**//// /// 刷新指定的祖先页面,注意是"祖先页面" /// public static void RefreshAncestorPage(HttpResponse Response ,string targetPageTitle ,bool isCloseCurPage)//targetPageTitle 目标页面的title { StringBuilder scriptString = new StringBuilder(); scriptString.Append(" */ #endregion 2.如何刷新祖先页面中的某个frame中的page了? RefreshFrameInAncestorPage#region RefreshFrameInAncestorPage /**//// /// 刷新指定的祖先页面中的某个框架的内部页面 /// public static void RefreshFrameInAncestorPage(HttpResponse Response ,string ancestorTitle ,string frameName ,string targetUrl ,bool isCloseCurPage)//targetPageTitle 目标页面的title { StringBuilder scriptString = new StringBuilder(); scriptString.Append("