"Including" multiple files?

  • Thread starter Thread starter farmer
  • Start date Start date
F

farmer

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~
 
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.
 
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.
 
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?
 
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? : )
 
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!
 
Back
Top