如何在自定义控件中,添加自定义的处理事件。
如题,例如我做了个控件:
public class WebCustomControl1 : System.Web.UI.Control
{
…………
}
Aspx页面中这样用
<%@ Register TagPrefix="Controls" Namespace="MyBussiSite.Web.Controls" Assembly="MyBussiSite.Web" %>
……
<Controls:WebCustomControl2 id="ctrls2" Runat="Server" />
……
我要在WebCustomControl2控件中添加OnClick事件,也就是说,当点击WebCustomControl2时,
触发OnClick事件:
InitializeComponent() 中添加:
this.ctrls2.Click += new System.EventHandler(this.ctrls2_Click);
……
怎么实现呢?