ASP.NET- Instantiate a Web User Control in App_Code class

asp.net

Solution

Normally, I'd do something like this (assuming your type is "Map" and that you have the appropriate "Inherits" declaration in your .ascx file):

Map map = (Map)LoadControl("~/Controls/map.ascx");

Problem

Files: Website\Controls\map.ascx Website\App_Code\map.cs I'd like to create a strongly typed instance of map.ascx in map.cs Normally, in an aspx, you would add a <%Register... tag to be able to instantiate in codebehind. Is this possible in an app_code class? I'm using .NET 3.5/Visual Studio 2008 Thanks!

Original source