By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,454 Members | 1,803 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,454 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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...Product=aspnet

Av.

"littlecharva" <an*******@discussions.microsoft.com> wrote in message
news:AC**********************************@microsof t.com...
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

Nov 18 '05 #2

P: n/a
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/us...ercontrols.asp

Happy Programming!
avnrao wrote:
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...Product=aspnet

Av.

"littlecharva" <an*******@discussions.microsoft.com> wrote in message
news:AC**********************************@microsof t.com...
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


--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
Nov 18 '05 #3

P: n/a

"Ben" <an*******@discussions.microsoft.com> wrote in message news:AF**********************************@microsof t.com...
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
Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.