一个简单的事件冒泡,请大家帮忙看一下。
一个自定义控件,里面就包含一个button
b是一个Button的实例。
protected override void Render(HtmlTextWriter output)
{
b.RenderControl(output);
this.EnsureChildControls();
base.Render(output);
}
protected override bool OnBubbleEvent(object source, EventArgs args)
{
if(source is Button)
{
OnLogin(System.EventArgs.Empty);
return true;
}
else
return base.OnBubbleEvent (source, args);
}
protected void OnLogin(EventArgs e)
{
if(Login!=null)
this.Login(this,e);
}
然后在在另一个项目中给这个控件添加事件处理 但是没有作用,请大家帮忙看看那里写错了!