how can i add a Customcontrol to another Customcontrol

Posted by scatman on Stack Overflow See other posts from Stack Overflow or by scatman
Published on 2010-06-08T07:29:37Z Indexed on 2010/06/08 7:32 UTC
Read the original article Hit count: 380

Filed under:
|

i want to create a CustomControl: TextList that extends a listBox. TextList : ListBox

on CreateChildControls of the TextList i tried to put the followig code in order to create a textbox for every listBox:

 protected override void CreateChildControls()
 {
    TextBox t = new TextBox();
    t.ID ="1"; //just an example
    this.Controls.Add(t);
    base.CreateChildControls();
 }

the textbox is not displayed when i call TextList in aspx. i don't think that this is the right way of doing it.

so is there a possible workaround to add a control to another control?

© Stack Overflow or respective owner

Related posts about c#

Related posts about custom-controls