)asp.net的一點代碼

來源:互聯網
上載者:User
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("

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.