I have a UserControl that I need to add dynamically. I tried to follow this MSDN article, but I\'m not having any success.... http://msdn.microsoft.com/en-us/library/c0az2h8
The ASP namespace is generated at run time- user controls get "compiled" as they are used by .aspx pages so this is why you get the error message "Type ASP.PictureGallery is not defined".
When adding user controls dynamically you should use the Page.LoadControl method:
Page.LoadControl("~/PictureGallery.ascx")