"Including" multiple files?

Discussion in 'ASP .Net' started by farmer, Aug 2, 2005.

  1. farmer

    farmer Guest

    I need "include" multiple classes from multiple files such as:
    <%@ Page Language="C#" Debug="true" ValidateRequest="false"
    Src="~/Auth/Pub/Auth.cs"%>
    <%@ Page Language="C#" Debug="true" ValidateRequest="false"
    Src="~/Edit/Item.cs"%>

    But the compile says can't use more than one "@Page" directive.

    Or,I need to "include" another class from a .cs into a currently .ascx
    using:

    <%@ Page Language="C#" Debug="true" ValidateRequest="false"
    Src="~/Auth/Pub/Auth.cs"%>
    <%@ Import namespace="Auth" %>

    But I got:
    Parser Error Message: The directive 'page' is unknown.

    How can I do?Thx~
     
    farmer, Aug 2, 2005
    #1
    1. Advertising

  2. farmer

    Lucas Tam Guest

    "farmer" <> wrote in news:1122954013.405163.91040
    @z14g2000cwz.googlegroups.com:

    > I need "include" multiple classes from multiple files such as:
    > <%@ Page Language="C#" Debug="true" ValidateRequest="false"
    > Src="~/Auth/Pub/Auth.cs"%>
    > <%@ Page Language="C#" Debug="true" ValidateRequest="false"
    > Src="~/Edit/Item.cs"%>
    >
    > But the compile says can't use more than one "@Page" directive.
    >
    > Or,I need to "include" another class from a .cs into a currently .ascx
    > using:
    >
    > <%@ Page Language="C#" Debug="true" ValidateRequest="false"
    > Src="~/Auth/Pub/Auth.cs"%>
    > <%@ Import namespace="Auth" %>
    >
    > But I got:
    > Parser Error Message: The directive 'page' is unknown.



    There's no need to include files like that in .NET... Are you using
    VS.NET? Just add the files to your project, and you can reference the
    classes by name in code.


    Or you can use User Controls to encapsulate stuff.

    Or you can use MasterPages to build page templates.


    --
    Lucas Tam ()
    Please delete "REMOVE" from the e-mail address when replying.
    http://members.ebay.com/aboutme/coolspot18/
     
    Lucas Tam, Aug 2, 2005
    #2
    1. Advertising

  3. farmer

    farmer Guest

    By the way,I don't like mess all thing into App_Code\ Folder.And as you
    can see, I am using ASP.NET 2.0.
     
    farmer, Aug 2, 2005
    #3
  4. farmer

    farmer Guest

    Thank you,Dear Tam!

    I am not using VS.NET IDE just now. Would you mind show me line text
    that how that looks like in source code?
     
    farmer, Aug 2, 2005
    #4
  5. farmer

    Lucas Tam Guest

    "farmer" <> wrote in news:1122954743.061157.91760
    @g14g2000cwa.googlegroups.com:

    > Thank you,Dear Tam!
    >
    > I am not using VS.NET IDE just now. Would you mind show me line text
    > that how that looks like in source code?



    In VS.NET... it does all the linking for you.

    Say in Edit.vb it contains a class called Edit. User.vb contains a class
    called User. These files can be anywhere within the project (i.e. within
    their own subdirectory... or within their own DLL. If you're using a
    DLL, then you'll need to add a reference).

    In code, I would go:

    Dim MyUser as User = New User
    Dim MyEditor as Editor = New Editor

    Unfortunately I don't know how VS.NET links the files all together...
    but I'm sure there is a non-editor equivalent.

    BTW, have you tried using the free ASP.NET editor on http://www.asp.net?
    Perhaps that will help you manage your code? : )

    --
    Lucas Tam ()
    Please delete "REMOVE" from the e-mail address when replying.
    http://members.ebay.com/aboutme/coolspot18/
     
    Lucas Tam, Aug 2, 2005
    #5
  6. farmer

    farmer Guest

    I understand that. VS.NET must put some stuff into "App_Code\" folder
    for sharing purpose.

    Well,maybe this is the only way for my purpose.

    Thank you sooo much!
     
    farmer, Aug 2, 2005
    #6
    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. Phillip
    Replies:
    0
    Views:
    1,187
    Phillip
    Jun 25, 2003
  2. Julien Phalip
    Replies:
    0
    Views:
    428
    Julien Phalip
    Feb 10, 2005
  3. Replies:
    4
    Views:
    957
    M.E.Farmer
    Feb 13, 2005
  4. Raman
    Replies:
    5
    Views:
    365
    Lew Pitcher
    Jun 7, 2008
  5. none
    Replies:
    8
    Views:
    368
    Jonathan Lee
    May 9, 2010
Loading...

Share This Page