Re: Not able to put class into namespace
- From: bruce barker <nospam@xxxxxxxxxx>
- Date: Fri, 10 Apr 2009 18:26:35 -0700
asp.net uses partial the partial class model to combine the codebenind file and the class file generated by the page compile.
if the namspace of the page (which defines the control names) is different then the namespace in codebehind, then you need to fully qualify the control names as they are in a differnt namespace.
I believe the default namespace for the page is ASP. You could also make the namespace of the page match the codebehind namespace via the ClassName in the <@page> directive.
note: designer files are only required with web applications, and not sure if they support namespaces.
-- bruce (sqlwork.com)
K Viltersten wrote:
I've designed a class as below..
public partial class Test : System.Web.UI.Page {
protected void Page_Load(
object sender, EventArgs e)
{
...
ThatLabel.Text = "!";
...
} ...
}
Now, i'd like to place it into a namespace but when i do that, it seems
that the controls i refer to (ThatLabel)
are, do not exist in the current context.
What is the reason for that and how can
i resolve the problem?
The only guess i have is that the class
begin partial, has other parts of it somewhere and THAT OTHER part, declaring
and creating the actual control, gets placed OUTSIDE the new namespace. However, i haven't found "the rest" of
the code. How can i get to it?
- References:
- Not able to put class into namespace
- From: K Viltersten
- Not able to put class into namespace
- Prev by Date: Re: How to align the <hr> element to the left?
- Next by Date: Re: problem with '<' character
- Previous by thread: Re: Not able to put class into namespace
- Next by thread: Regular Expression Validator syntax
- Index(es):
Relevant Pages
|
Loading