Adding a usercontrol to a WebControl

J

John Giblin

I am trying to add a usercontrol to my webcontrol and I seem to be
stuck. I see the method add in the control, but I cannot add the user
control that way. Any Ideas. Is it possible
 
J

John Giblin

Just in case someone else is looking for this,. here is what I did.

To get the usercontrol
UserControl usercontrol
=(UserControl)Page.LoadControl("~/usercontrols/common/Event_Add.ascx"
);
this.Controls.Add(usercontrol);


protected override void RenderContents(HtmlTextWriter writer)
{
foreach (UserControl current in this.Controls)
{
current.RenderControl(writer);

}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,526
Members
44,997
Latest member
mileyka

Latest Threads

Top