我們都知道在Window Form中使用MessageBox.Show可以跳出一個訊息,那在Web Form呢?似乎只能透過ClientScript、Literal、或者Response.Write等方式來跳出警示訊息囉,其實我們也可以把這樣的功能包裝成一個MesageBox的class,下面這段code在網路上應該很多地方都找的到,我自己也忘記是從哪邊找來的了,不過還是分享出來給大家囉: view sourceprint?01 ///
02 /// Summary description for MessageBox. 03 /// 04 public class MessageBox 05 { 06 private static Hashtable m_executingPages = new Hashtable(); 07 private MessageBox(){} 08 ///
09 /// MessageBox訊息窗 10 /// 11 ///
要顯示的訊息 12 public static void Show( string sMessage ) 13 { 14 // If this is the first time a page has called this method then 15 if( !m_executingPages.Contains( HttpContext.Current.Handler ) ) 16 { 17 // Attempt to cast HttpHandler as a Page. 18 Page executingPage = HttpContext.Current.Handler as Page; 19 if( executingPage != null ) 20 { 21 // Create a Queue to hold one or more messages. 22 Queue messageQueue = new Queue(); 23
[ASP.NET]WebForm中的MessageBox.Show
最新推荐文章于 2013-11-20 20:49:40 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)