"Including" multiple files?

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~
 
L

Lucas Tam

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.
 
F

farmer

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.
 
F

farmer

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?
 
L

Lucas Tam

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? : )
 
F

farmer

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!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top