另外一个文件定义了枚举和参数类:
using System; namespace ZZ { public class LogInOutEventArgs : EventArgs { private LogInClickType type; private bool result;
public LogInOutEventArgs(LogInClickType type,bool result):base() { this.type = type; this.result = result; } public LogInClickType Type { get{return this.type;} } //操作结果, public bool Result { get{return this.result;} } } //操作类型 public enum LogInClickType : int { LongIn, LongOut } //定义语言 public enum Language { Chinese, English } }
在后台代码中添加事件和属性。 虽然在前台添加了LogInOutControl1,但是后台代码中不会生成protected LogInOutControl LogInOutControl1;这条语句,我觉得很奇怪,不管先加上他。 接着在Page_Load事件中注册LogInOutClick事件:
this.LogInOutControl1.LogInOutClick += new LogInOutClickHandler(LogInOutControl1_LogInOutClick); 完整代码如下:
using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web