[ASP.net]Loading制作
点击次数:21 次 发布日期:2008-11-26 23:51:03 作者:源代码网
|
源代码网推荐打了包成了个控件。下载地址: 源代码网推荐http://upserver4.ys168.com/ys168up/D1/YY1.aspx?f=050P1D8E0E3E5D9D5G6ALI7A00A05AKA03D6A00A08A08I5F9G0E0D9E0D8D6E1A24E6E1D9E5D9C3 源代码网推荐 源代码网推荐下面是源码: 源代码网推荐 源代码网推荐=================================== 源代码网推荐 源代码网推荐using System; 源代码网推荐 源代码网推荐namespace HDControl 源代码网推荐{ 源代码网推荐 /// <summary> 源代码网推荐 /// Summary description for Loading. 源代码网推荐 /// </summary> 源代码网推荐 public class Loading 源代码网推荐 { 源代码网推荐 private System.Web.UI.Page Sender; 源代码网推荐 private string strImagePath; 源代码网推荐 源代码网推荐 public object Page 源代码网推荐 { 源代码网推荐 get 源代码网推荐 { 源代码网推荐 return Sender; 源代码网推荐 } 源代码网推荐 set 源代码网推荐 { 源代码网推荐 Sender = (System.Web.UI.Page)value; 源代码网推荐 } 源代码网推荐 } 源代码网推荐 源代码网推荐 public string ImageMapth 源代码网推荐 { 源代码网推荐 get 源代码网推荐 { 源代码网推荐 return strImagePath; 源代码网推荐 } 源代码网推荐 set 源代码网推荐 { 源代码网推荐 strImagePath = value; 源代码网推荐 } 源代码网推荐 } 源代码网推荐 源代码网推荐 public Loading() 源代码网推荐 { 源代码网推荐 // 源代码网推荐 } 源代码网推荐 源代码网推荐 public Loading( object sender ) 源代码网推荐 { 源代码网推荐 Page = sender; 源代码网推荐 } 源代码网推荐 源代码网推荐 public Loading( object sender,string ImageMapth ) 源代码网推荐 { 源代码网推荐 Page = sender; 源代码网推荐 this.strImagePath = ImageMapth; 源代码网推荐 } 源代码网推荐 源代码网推荐 /// <summary> 源代码网推荐 /// Load script to page 源代码网推荐 /// </summary> 源代码网推荐 public void Load() 源代码网推荐 { 源代码网推荐 if ( !this.Sender.IsClientscriptBlockRegistered( "startscript" ) ) 源代码网推荐 { 源代码网推荐 this.Sender.RegisterClientscriptBlock( "startscript",this.Start() ); 源代码网推荐 this.Sender.RegisterStartupscript( "endscript",this.End() ); 源代码网推荐 } 源代码网推荐 } 源代码网推荐 源代码网推荐 /// <summary> 源代码网推荐 /// script start. 源代码网推荐 /// </summary> 源代码网推荐 /// <returns></returns> 源代码网推荐 private string Start() 源代码网推荐 { 源代码网推荐 string strStyle = "BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none"; 源代码网推荐 System.Text.StringBuilder strscript = new System.Text.StringBuilder(); 源代码网推荐 strscript.Append( "<div id="loading">" ); 源代码网推荐 strscript.Append( "<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" style=""+ strStyle + "">" ); 源代码网推荐 strscript.Append( "<tr style="" + strStyle + "" ><td width="100%" height="100%" align="center" valign="middle" style="" + strStyle + "">" ); 源代码网推荐 strscript.Append( "<img src="" + this.ImageMapth + "" border="0">" ); 源代码网推荐 strscript.Append( "</td></tr>" ); 源代码网推荐 strscript.Append( "</table></div>" ); 源代码网推荐 return strscript.ToString(); 源代码网推荐 } 源代码网推荐 源代码网推荐 /// <summary> 源代码网推荐 /// script end. 源代码网推荐 /// </summary> 源代码网推荐 /// <returns></returns> 源代码网推荐 private string End() 源代码网推荐 { 源代码网推荐 System.Text.StringBuilder strscript = new System.Text.StringBuilder(); 源代码网推荐 strscript.Append( "<script language="javascript">" ); 源代码网推荐 strscript.Append( "window.document.getElementById("loading").style.display = "none";" ); 源代码网推荐 strscript.Append( "</script>" ); 源代码网推荐 return strscript.ToString(); 源代码网推荐 } 源代码网推荐 } 源代码网推荐} 源代码网推荐 源代码网推荐 源代码网推荐========================= 源代码网推荐 源代码网推荐先在面页中 源代码网推荐 源代码网推荐using HDControl; 源代码网推荐 源代码网推荐调用方法(在Page_Load里): 源代码网推荐 源代码网推荐LoadingControl.Loading objLoad = new LoadingControl.Loading( this,"Images/loading.gif" ); 源代码网推荐objLoad.Load(); 源代码网推荐 源代码网推荐或: 源代码网推荐 源代码网推荐LoadingControl.Loading objLoad = new LoadingControl.Loading( ); 源代码网推荐objLoad.Page = this; 源代码网推荐objLoad.ImageMapth = "Images/loading.gif"; 源代码网推荐objLoad.Load(); 源代码网推荐 源代码网推荐 源代码网推荐 源代码网供稿. |
