views:

348

answers:

2

Classes I create in ~/App_Code are put into the App_Code assembly.

If I create the following ASP.NET UserControl:

~/UserControls/BasicUserControl.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="BasicUserControl.ascx.cs" Inherits="UserControl_BasicUserControl" %>
Hello world!

~/UserControls/BasicUserControl.ascx.cs

using System;

public partial class UserControl_BasicUserControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}

What assembly would this dynamic ASP.NET UserControl be added to?

+3  A: 

Build your website then checkout the ASP.UserControls_BasicUserControl_ascx namespace/class

everytime you make a change to the .ascx you will have to build the project for the changes to show up in intellisense though

Element
Are you talking about precompiling the web site? This technique is explained here - http://blogs.msdn.com/davidebb/archive/2005/10/30/487160.aspx Is this the only method available?
Gabe
No not precomiplation just for visual studio intellisense to pickup the control you need to build the project (I assume its beacause it has to use reflection on the generated assembly to list the members)
Element
A: 

If you open the newly created UserControl assembly you will realize that the namespace for the UserControl is ASP. So, this means that when registering the usercontrol on the page using the register directive you must mention the namespace as ASP. After that compile and rebuild your application and you will have the intellisense support.

I have created a video on this scenario let me know and I will post a link.

azamsharp