Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Namespace not found in aspx but IS found in code behind

Reply
Thread Tools

Namespace not found in aspx but IS found in code behind

 
 
William Parker
Guest
Posts: n/a
 
      06-27-2004
I have a class library that I built which I have added a reference to using
the Add Reference option.

Within my C# webform1.aspx I get a compile error with the following line
stating that the type or namespace was found and asking if I'm missing a
reference:
<% MyNamespace.MyObj abc; %>

However if I place this same line within the webform1.aspx.cs (code behind
page), say in the Page_Load event then it WORKS FINE.
MyNamespace.MyObj abc;

So, what would be different that would cause the aspx to error out at
compile time when running the page for the first time, compared to
everything working perfectly if I do the same code from the code behind
page? All this of course is within the same project and I definately do
have a reference to the class library where MyNamespace.MyObj is defined.
In case it matters this is with Framework 1.0 and VS.NET 2002.

Thanks!!


 
Reply With Quote
 
 
 
 
Martin
Guest
Posts: n/a
 
      06-27-2004
<%@ import namespace="value"%> (NB the space)

See
http://msdn.microsoft.com/library/en...asp?frame=true




"William Parker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a class library that I built which I have added a reference to

using
> the Add Reference option.
>
> Within my C# webform1.aspx I get a compile error with the following line
> stating that the type or namespace was found and asking if I'm missing a
> reference:
> <% MyNamespace.MyObj abc; %>
>
> However if I place this same line within the webform1.aspx.cs (code behind
> page), say in the Page_Load event then it WORKS FINE.
> MyNamespace.MyObj abc;
>
> So, what would be different that would cause the aspx to error out at
> compile time when running the page for the first time, compared to
> everything working perfectly if I do the same code from the code behind
> page? All this of course is within the same project and I definately do
> have a reference to the class library where MyNamespace.MyObj is defined.
> In case it matters this is with Framework 1.0 and VS.NET 2002.
>
> Thanks!!
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Non-code behind to code behind John ASP .Net 2 02-19-2007 07:08 PM
How to bring aspx code (in HTML view) to the aspx.vb code-behind? Paolo Pignatelli ASP .Net 6 02-21-2005 01:55 AM
Code being called twice in my ASPX Code behind?? C ASP .Net 2 08-06-2003 04:13 AM
Help:Why can't I use namespace System.Web? It is said that this namespace doesn't exist. But it should exist. ASP .Net 1 07-29-2003 04:31 PM
Re: Code Behind vs. no code behind: error Ben Miller [msft] ASP .Net 1 06-28-2003 01:46 AM



Advertisments