Doesn't compile page if I put the Class in a namespace...
-
Hello, take a look at the following line of code...
<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="_Default" %>
however, if I put the class
_Default
in a namespace, sayMyNamespace
and try the following line:<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="MyNamespace._Default" %>
VS generates an error:
Could not load type 'MyNamespace._Default'
Any help would be highly appreciated...
- A programmer's national anthem; "AAAAAHHHHH!!!!"
-
Hello, take a look at the following line of code...
<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="_Default" %>
however, if I put the class
_Default
in a namespace, sayMyNamespace
and try the following line:<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="MyNamespace._Default" %>
VS generates an error:
Could not load type 'MyNamespace._Default'
Any help would be highly appreciated...
- A programmer's national anthem; "AAAAAHHHHH!!!!"
-
remove the _ (underscore) from the
Inherits="MyNameSpace._Default"
toInherits="MyNameSpace.Default"
-
Hello, take a look at the following line of code...
<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="_Default" %>
however, if I put the class
_Default
in a namespace, sayMyNamespace
and try the following line:<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="MyNamespace._Default" %>
VS generates an error:
Could not load type 'MyNamespace._Default'
Any help would be highly appreciated...
- A programmer's national anthem; "AAAAAHHHHH!!!!"
signbit wrote:
however, if I put the class _Default in a namespace, say MyNamespace and try the following line: <%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="MyNamespace._Default" %>
Just to be sure, did you put codebehing class (in .cs file) into same namespace? I don't feel like firing up IDE, but I think that pages are always in some namespace (default project namespace), and you don't prefix class name in
Inherits
page directive. Did you try it without MyNamespace, add it only in codebehind?
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe