no, it was easier, just had to implement the INamingContainer Interface, now
it works
"intrader" <> schrieb im Newsbeitrag
news

. ..
> On Fri, 15 Jul 2005 21:28:08 +0200, Patrick wrote:
>
>> Hi
>>
>> I have an aspx-page, where I load my custom-control (see below). The
>> problem
>> I have is that the event does not fire. I really cant figure out why.
>> Just
>> to know, I derive from System.Web.UI.Control, becaues later on I want to
>> add
>> some more controls, but first I have to solve this problem.
>>
>> Has someone an idea?
>>
>> Thanks
>> Patrick
>>
>>
>> *************** default.aspx.cs
>> protected void Page_Load(object sender, EventArgs e)
>> {
>> Control ctrl = new Mycustomcontrol();
>> this.form1.Controls.Add(ctrl);
>> }
>>
>>
>> *************** Mycustomcontrol.cs
>> public class Mycustomcontrol: System.Web.UI.Control
>> {
>> private Button bt;
>>
>> protected override void CreateChildControls()
>> {
>>
>> bt = new Button();
>> bt.Text = "test";
>> this.Controls.Add(bt);
>> bt.Click += new EventHandler(bt_Click);
>> }
>>
>> protected void bt_Click(object sender, EventArgs e)
>> {
>> System.Web.HttpContext.Current.Response.Write("but ton was
>> clicked");
>> }
>>
>> }
> I am assuming that you don't see the "button was clicked" message.
> Is bubbling to the page your problem?
>
>