Reputation: 583
So I've got an App_code folder and I've got an ASP.Net file inside. But because I made that file in am other folder the Inherits is not right.
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="GridView.aspx.cs" Inherits="Pages_Management_GridView" %>
But if I write the App_Code Folder inside the Inherits tag, it doesn't work because of the underscore.
What can I do here?
Upvotes: 0
Views: 676
Reputation: 9725
Check the namespace isn't conflicting, because if you put the class in there then it should resolve correctly. Otherwise try putting the path in the 'codefile' attribute... Taken from here
Inherits
Defines a code-behind class for the page to inherit. This can be any class derived from the Page class. This attribute is used with the CodeFile attribute, which contains the path to the source file for the code-behind class. The Inherits attribute is case-sensitive when using C# as the page language, and case-insensitive when using Visual Basic as the page language.
If the Inherits attribute does not contain a namespace, ASP.NET checks whether the ClassName attribute contains a namespace. If so, ASP.NET attempts to load the class referenced in the Inherits attribute using the namespace of the ClassName attribute. (This assumes that the Inherits attribute and the ClassName attribute both use the same namespace.)
CodeFile
Specifies a path to the referenced code-behind file for the page. This attribute is used together with the Inherits attribute to associate a code-behind source file with a Web page. The attribute is valid only for compiled pages.
This attribute is used for Web site projects. The CodeBehind attribute is used for Web application projects. For more information about Web project types in Visual Studio, see Web Application Projects versus Web Site Projects.
Upvotes: 3