Namespace not found in aspx but IS found in code behind

Discussion in 'ASP .Net' started by William Parker, Jun 27, 2004.

  1. 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!!
     
    William Parker, Jun 27, 2004
    #1
    1. Advertising

  2. William Parker

    Martin Guest

    <%@ import namespace="value"%> (NB the space)

    See
    http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconImport.asp?frame=true




    "William Parker" <> wrote in message
    news:...
    > 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!!
    >
    >
     
    Martin, Jun 27, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben Miller [msft]

    Re: Code Behind vs. no code behind: error

    Ben Miller [msft], Jun 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    631
    Alphonse Giambrone
    Jun 28, 2003
  2. Èý¹â
    Replies:
    1
    Views:
    592
    William F. Robertson, Jr.
    Jul 29, 2003
  3. C
    Replies:
    2
    Views:
    460
    Natty Gur
    Aug 6, 2003
  4. Paolo Pignatelli
    Replies:
    6
    Views:
    2,223
    Paolo Pignatelli
    Feb 21, 2005
  5. John

    Non-code behind to code behind

    John, Feb 19, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    522
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Feb 19, 2007
Loading...

Share This Page