P
Pavel Simsa via .NET 247
Here's the problem: I have created a custom UserControl. I haveput a placeholder to my index page and now I'm trying to add theUserControl programatically. The problem is, the control doesnot show up.
Basically:
placeHolder1.Controls.Add(new Button()); works and new buttonappears in the placeholder and then I can access it without aproblem.
placeHolder1.Controls.Add(new myUserControl()); does not work,new myUserControl does not appear in the placeholder. Settingthe Visible property -"((myUserControl)placeHolder1.Controls[0]).Visible = true;" doesnot help but does not create an exception either so I presumethat the control is properly created, initialized and added tothe Controls collection of placeHolder1.
What am I doing wrong? Is there any thing special I have to do,either in the code/properties of the index page orcode/properties of the myUserControl.ascx file?
Thanks a million in advance
Basically:
placeHolder1.Controls.Add(new Button()); works and new buttonappears in the placeholder and then I can access it without aproblem.
placeHolder1.Controls.Add(new myUserControl()); does not work,new myUserControl does not appear in the placeholder. Settingthe Visible property -"((myUserControl)placeHolder1.Controls[0]).Visible = true;" doesnot help but does not create an exception either so I presumethat the control is properly created, initialized and added tothe Controls collection of placeHolder1.
What am I doing wrong? Is there any thing special I have to do,either in the code/properties of the index page orcode/properties of the myUserControl.ascx file?
Thanks a million in advance