Reputation: 1
I am having a problem with the page directive. The code behind file is CodeBehind.cs within the namespace aspnetian.
when i specify the inherit and src attribute like...
<%@ Page Language= "C#" src="~/CodeBehind.cs" inherits="aspnetian.CodeBehind.cs" %>
Parser Error Message: The base type 'aspnetian.CodeBehind.cs' does not exist in the source file '~/CodeBehind.cs'.
If I remove the namespace and specify the directive like...
<%@ Page Language= "C#" src="~/CodeBehind.cs" inherits="CodeBehind.cs" %>
it gives this error:
class 'codeBehind' and namespace 'CodeBehind', declared in 'D:\AspPractice\WebApplication1\WebApplication1\codeBehind.aspx.designer.vb', conflict in namespace 'WebApplication1'. D:\AspPractice\WebApplication1
\WebApplication1\codeBehind.aspx.vb
Please tell me where I am mistaken and whats the correct way.
Upvotes: 0
Views: 2248
Reputation: 36
The inherits property should be describing the class the Page will use. I'm assuming the class you created looks like so:
public class CodeBehind : public Page
{
// blah...
}
If that is the case then you just need to drop the .cs from the end of the inherits property.
Upvotes: 1
Reputation: 61599
Try this:
<%@ Page Language="C#" CodeFile="CodeBehind.cs" Inherits="aspnetian.CodeBehind" %>
Upvotes: 0