May 14, 2011, 10:10 PM
[CLOSED] Adding UserControl dynamically in code-behind
Hey,
I read a few posts here and also on the net about ASP.NET in general, but cant figure out how to dynamically add UserControls in code-behind.
I want to add my custom UserControl "CoreComment" to a Panel I have.
This is what I tried:
Any help is appreciated =)
I read a few posts here and also on the net about ASP.NET in general, but cant figure out how to dynamically add UserControls in code-behind.
I want to add my custom UserControl "CoreComment" to a Panel I have.
This is what I tried:
UserControls.CoreComment cc = new UserControls.CoreComment();
cc._Comment = c;
PanelComments.Controls.Add(cc);
Here I see no controls rendered. I also tried to add "cc.RenderControl(...)" but I dont really know what or how to use/get a HtmlTextWriter or if that is the right way to go.Any help is appreciated =)
Last edited by Daniil; May 17, 2011 at 9:49 PM.
Reason: [CLOSED]