#include files?

M

Mike Laskie

Hi,

Am porting an ASP application to ASP.NET, server side C# and not seeing
anything on how to handle something like the following...

<!-- #include file = "myfile.inc" -->


Am not have much luck with ...
/// <include file='myfile.inc' path='/inc' >

Any ideas? We use a few include files.

Thanks,

- Mike
 
M

Mark Kamoski

Mike--

Check out UserControls.

They are a great way to simulate the use of "include files" in this
post-ASPClassic era.

They are easy to use, and VERY powerful.

HTH.

--Mark


Hi,

Am porting an ASP application to ASP.NET, server side C# and not seeing
anything on how to handle something like the following...

<!-- #include file = "myfile.inc" -->


Am not have much luck with ...
/// <include file='myfile.inc' path='/inc' >

Any ideas? We use a few include files.

Thanks,

- Mike
 
D

DKrapohl

As a boost into User Controls (which is what you are talking about),
here's the following microwave primer:

Create a new user control that has the resuable items you want (a
header in this example) and call it header.ascx. Put an image in it
for now.

Under the 'page language' tag in the aspx page you want to reuse the
file in, put the following:

<%@ Register TagPrefix="YourHeader" TagName="TheHead"
Src="header.ascx"%>

Then in the place you want to see it on the page (in a table row in
this example) you'd say:

<tr>
<td>
<YourHeader:TheHead id="MyTag" runat="server"
name="MyTag"></YourHeader:TheHead>
</td>
</tr>

Compile and view it. Your image will be properly included.


Don Krapohl
http://www.tranquillitas.com
Website quality assurance testing
 
D

DKrapohl

You can create a class and then write the 'Imports MyClass' line at
the top of the page (after the page directive) and put all of your
constants in it. This is probably a more elegant solution in line
with your question. But in the end, I believe that you can still use
the old style #include statement. A benefit of using a class right
off the top of my head is that you have intellisense which should make
MSFT wealthy if that's all they ever did for us.

Please let me know if I am incorrect in my statement regarding the
classic #includes.

Don Krapohl
http://www.tranquillitas.com
Website quality assurance testing
 
M

Mike Laskie

And is at the top of mine, yep, nice feature.

What I find is the following preprocessors...
#if
#else
#elif
#endif
#define
#undef
#warning
#error
#line
#region
#endregion
I remember reading about this and seeing an example, just haven't been able to recall. At runtime/debugtime the included code (sheesh I got to stop calling it that) is inserted into the body and seamlessly present to step through.
 

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,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top