在Asp.net中使用事件
在用户控件中编写事件:
public class UsePageEventArgs : EventArgs
{
private int pageindex;

public UsePageEventArgs(int pageindex)
{
this.pageindex = pageindex;
}

public int Pageindex
{
get { return pageindex; }
set { pageindex = value; }
}
}

public delegate void SetUserPageHandler(object sender, UsePageEventArgs e);

public partial class controls_Control : System.Web.UI.UserControl
{
public event SetUserPageHandler OnSetUserPage;





}
在调用时,必须在使用页的OnInit中订阅事件,必须!否则报错为Null。
在WinForm程序中使用时,在启动中订阅就可以。



























在调用时,必须在使用页的OnInit中订阅事件,必须!否则报错为Null。
在WinForm程序中使用时,在启动中订阅就可以。