You can use something like this:
this.Controls.A dd( Page.LoadContro l("MyControl.as cx"));
If you want to put it in a specific place, use a placeholder or panel
control:
In your .aspx:
<asp:PlaceHolde r id="dynamicCtl " runat="server" />
in your .aspx.cs :
....
if( someFlag)
{
dynamicCtl.Cont rols.Add( Page.LoadContro l("MyControl.as cx"));
}
else
{
dynamicCtl.Cont rols.Add( Page.LoadContro l("MyOtherContr ol.ascx"));
}
....
Note that dynamically placing controls has some behavior changes you should
think about, especially the fact that the usercontrol's child controls
will not keep their state anymore.
-Philip
"ilPostino" <ne**@ip80.co m> wrote in message
news:OM******** ******@TK2MSFTN GP09.phx.gbl...
ok, so I have my asp.net application.
I want a single page which can load asp user controls and at runtime. How
can this be done? I don't want to drag the control onto the page because
then I can't change it ... or can I ?
thanks
C