自定义事件

mac2022-06-30  19

using  System; using  System.Web.UI; using  Tripal.Web.Biz.Common; using  System.Web.UI.WebControls; namespace   ***** .Web.Biz.UI.Common{     public   delegate   void  CallBackEventHandler( object  sender, CallBackArgs e);         public   class  CallBackArgs:EventArgs    {         public   CallBackArgs( string  commandName,  string  commandArgument)        {            _commandArgument  =  commandArgument;            _commandName  =  commandName;        }         private   string  _commandName;         public   string  CommandName        {             set {_commandName = value;}             get { return  _commandName;}        }         private   string  _commandArgument;         public   string  CommandArgument        {             set {_commandArgument  =  value;}             get { return  _commandArgument;}        }    }     ///   <summary>      ///  Call 的摘要说明。     ///   </summary>      public   class  CallBackCustomerControl : Telerik.WebControls.RadCallback    {         protected   override   void  OnInit(EventArgs e)        {             base .OnInit (e);             this .Callback  += new  CallbackEvent(CallBackCustomerControl_Callback);        }         private   void  CallBackCustomerControl_Callback( object  sender, Telerik.WebControls.CallbackEventArgs args)         {             if ( ProcessCallBack  !=   null  )            {                CallBackArgs e  =   new  CallBackArgs( args.CallbackEvent, args.Args );                ProcessCallBack( sender, e );            }        }             protected   override   void  Render(HtmlTextWriter writer)        {             base .Render (writer);            writer.Write(  " <script>  function  " + this .ClientID + " MakeCallback( commandName, commandArgument ) { MakeCallback(' " + this .ClientID + " ', commandName, commandArgument); } </script> " );         }         // 事件          public   event  CallBackEventHandler ProcessCallBack;                    }}

转载于:https://www.cnblogs.com/Elong/archive/2006/07/11/447707.html

最新回复(0)