add WebUserControls dynamically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey all,
let's say i have a WebUserControl that has a GridView in it. i have a blank
web form on the page and in the code behind i'd like to dynamically create
that WebUserControl could someone please show me a good article or some
syntax to send the concept home for me?

thanks,
rodchar
 
How about this
base.CreateChildControls();

Controls.Clear();



usercontrol =
(UserControl)Page.LoadControl(@"/ManagedUsercontrolLibrary/WebUserControl1.ascx");



Controls.Add(usercontrol);



Assuming you have a directory called managedusercontrollibrary and an ascx
file in it.


--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
 
i figured all i would have to do is istantiate the WebUserControl and i'd be
"good to go"?
 
Back
Top