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

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top