0

I have a web application in Visual Studio 2013. There is a single project in the solution. I'm trying to add a custom server control to the project App_Code folder then registering it on the aspx page but it keeps saying the type or namespace doesn't exist when i clean and rebuild. I've also tried moving the file into a separate project then adding a reference to the web project but I get the same error. To keep things simple everything is under the same MotorPool namespace. I've also tried a different namespace for CustomGridView.cs such as Controls or MotorPool.Controls but I still get the same error.

The error is in the designer file:

The type or namespace name 'CustomGridView' does not exist in the namespace 'MotorPool' (are you missing an assembly reference?)

And here's the line it's complaining about:

protected global::MotorPool.CustomGridView GridView1;

I'm banging my head... need some help figuring this out.

~/App_Code/CustomGridView.cs

namespace MotorPool
{
    public class CustomGridView : GridView
    {
        public CustomGridView()
        {
        }
    }
}

~/Assets.aspx

<%@ Register Assembly="MotorPool" Namespace="MotorPool" TagPrefix="uc" %>

<uc:CustomGridView ID="GridView1" runat="server />

And what happened to Web Site projects? I don't have that template installed and couldn't find a way to add it. Does Microsoft want to move away from them? I was going to try creating a web site project and copying the files over.

user3321095
  • 185
  • 1
  • 10
  • Could you look at this answer - [Unable to call App_Code class from a code-behind](http://stackoverflow.com/questions/14204990/unable-to-call-app-code-class-from-a-code-behind/14206137#14206137)? – Win Jan 22 '16 at 00:37
  • That was it. Thanks so much! – user3321095 Jan 22 '16 at 01:53

0 Answers0