Dynamic adding of usercontrols not showing control on page
- by Phil
I am trying to insert a user control dynamically into my default.aspx page via the following method in the page_init:
Dim control As UserControl = LoadControl("~\Modules\Content.ascx")
Controls.Add(control)
When I run the page there is no sign of the usercontrol.
Am I using the correct code to insert the usercontrol?
Is there an alternative method of insertion available?
Does the fact that the usercontrol has a page_load make a difference?
Do I need to register the control in my aspx page at design time?
Thanks in advance for any assistance you can offer.