|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
composite control does not fire eventI 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("button was clicked"); } } In message <e7kVZt2iFHA.1***@TK2MSFTNGP12.phx.gbl>, Patrick
<patrick***@bluemail.ch> writes >Hi Add the marker interface INamingContainer to your control.> >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. -- Steve Walker Hi Steve
Thanks, that was the problem :-) Patrick Show quoteHide quote "Steve Walker" <st***@otolith.demon.co.uk> schrieb im Newsbeitrag news:tb58ZgN2s42CFwHa@otolith.demon.co.uk... > > > In message <e7kVZt2iFHA.1***@TK2MSFTNGP12.phx.gbl>, Patrick > <patrick***@bluemail.ch> 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 In message <OIWm3S6iFHA.1***@TK2MSFTNGP10.phx.gbl>, Patrick
<patrick***@bluemail.ch> writes Show quoteHide quote >> In message <e7kVZt2iFHA.1***@TK2MSFTNGP12.phx.gbl>, Patrick You're welcome. I write controls all the time, and that one still bites >> <patrick***@bluemail.ch> writes >"Steve Walker" <st***@otolith.demon.co.uk> schrieb im Newsbeitrag >news:tb58ZgN2s42CFwHa@otolith.demon.co.uk... >>>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 :-) me now and then. -- Steve Walker
Cannot change font in Webcontrol treeview node
Timer.Elapsed event doesn't want to fire Working with Mac Safari Browser Stack Over Flow Message in IE How do I find out the page name in ASP Datagrid navigation problem asp.net: Composite Control with GridView Using OpenFileDialog Using OpenFileDialog How do I get a custom Control Designer to write to the HTML of my control? |
|||||||||||||||||||||||