Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > composite control does not fire event

Reply
Thread Tools

composite control does not fire event

 
 
Patrick
Guest
Posts: n/a
 
      07-18-2005
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");
}

}



 
Reply With Quote
 
 
 
 
Steve Walker
Guest
Posts: n/a
 
      07-18-2005


In message <(E-Mail Removed)>, Patrick
<(E-Mail Removed)> writes
>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.


Add the marker interface INamingContainer to your control.


--
Steve Walker
 
Reply With Quote
 
 
 
 
Patrick
Guest
Posts: n/a
 
      07-18-2005
Hi Steve

Thanks, that was the problem

Patrick

"Steve Walker" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
>
>
> In message <(E-Mail Removed)>, Patrick
> <(E-Mail Removed)> writes
>>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.

>
> Add the marker interface INamingContainer to your control.
>
>
> --
> Steve Walker



 
Reply With Quote
 
Steve Walker
Guest
Posts: n/a
 
      07-18-2005
In message <(E-Mail Removed)>, Patrick
<(E-Mail Removed)> writes
>> In message <(E-Mail Removed)>, Patrick
>> <(E-Mail Removed)> writes

>"Steve Walker" <(E-Mail Removed)> schrieb im Newsbeitrag
>news:(E-Mail Removed)...


>>>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.


>> Add the marker interface INamingContainer to your control.


>Thanks, that was the problem


You're welcome. I write controls all the time, and that one still bites
me now and then.

--
Steve Walker
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to fire a client event from a composite control Joe Abou Jaoude ASP .Net Building Controls 1 07-04-2007 04:26 AM
composite control does not fire event Patrick ASP .Net Building Controls 1 07-19-2005 06:35 AM
Losing Composite Control property that another Composite Control ... Chad ASP .Net Building Controls 0 02-01-2005 09:01 PM
Possible to create a composite control that has a child control that is a validator that validates the composite control itself? Jonathan Eric Miller ASP .Net Building Controls 2 07-22-2004 10:58 PM
Composite Control datagrid event does not fire C. Ramsey ASP .Net Building Controls 1 09-15-2003 08:31 PM



Advertisments