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("