ChildControl of a childcontrol is null when calling from Main control

Posted by Jan Schoenrock on Stack Overflow See other posts from Stack Overflow or by Jan Schoenrock
Published on 2009-05-05T18:46:55Z Indexed on 2010/03/18 2:01 UTC
Read the original article Hit count: 305

Filed under:
|

Hello I built a webusercontrol in asp.net which contains a databound dropdown. When I directly put this control into a webform it runs well. But if I try to add this control as childcontrol to another control at runtime

Childcontrol childcontrol = new Childcontrol ();
maincontrol.controls.add(childcontrol)

, the dropdown of the childcontrol is not instatiated (is null) so that I run in an exception by trying to bind the data to the dropdown.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about controls