我的自定义控件的代码如下:
public class Panel : System.Web.UI.WebControls.WebControl
{
private System.Web.UI.WebControls.Panel _Buttons;
[PersistenceMode(InnerProperty)]
public System.Web.UI.WebControls.Panel Buttons
{
get
{
if (this._Buttons == null)
this._Buttons = new Panel();
return this._Buttons;
}
}
public Panel()
: base("div")
{
}
protected override void CreateChildControls()
{
this.Controls.Add(this.Buttons);
base.CreateChildControls();
}
}
我将控件放在网页表单中,如下所示:
<Sunny:Panel runat=server>
<Buttons>
<asp:Button runat=server OnClick=Text_Click />
</Buttons>
</Sunny:Panel>
问题是按钮“Text_Click”的“点击事件”不会触发。
提前感谢您的帮助!