Is there an '<!--#include...' directive in .NET?

G

Guest

Hi

I'm trying to write a webpage in ASP.NET using code behind. My code behind page works fine, but now I want to create an instance of an object who's class is stored in a different file. In ASP I've have just used the old <!--#include virtual="file.asp"-->, surely there's something similar I can use in my .cs file

BTW, I'm not using Visual Studio

Cheers

littlecharva
 
S

Scott Mitchell [MVP]

Another article on User Controls that I'd encourage you to read is:

An Extensive Examination of User Controls
http://msdn.microsoft.com/asp.net/u...l=/library/en-us/dnaspp/html/usercontrols.asp

Happy Programming!

User Controls in .Net are similar to #include in asp. try converting your
code behind and html content to a user control.
check this article :
http://support.microsoft.com/default.aspx?scid=kb;en-us;319100&Product=aspnet

Av.


--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 
H

Hans Kesting

Ben said:
If you're just instantiating a class, you don't need to physically reference a file as long as the file that class is in is also
in the same project as your web page. Once compiled, you can create an instance of that class in any of your web pages.

It *is* possible to use classes from different projects: you need to add a "reference" to your *project*
(not to the specific aspx/ascx)
this reference can point to the project that contains the classes you want to use
(if that project is in the same solution) or to the physical dll that contains those classes.

Hans Kesting
 

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

Forum statistics

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

Latest Threads

Top