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

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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!
 
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
 
Back
Top