473,408 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

ASP.NET Includes Text or HTML Files into ASPX pages

I'm trying to find out how to INCLUDE a file (text or html
etc) into my ASPX page.
I don't want to know how to create a user control etc just
a quick simple example.

Looking for something similar to the old fashioned ASP
include <!--#include file="time.inc"--> but a .NET version.

Jul 21 '05 #1
5 12190

"Bari" <ba****@hotmail.com> wrote in message
news:03****************************@phx.gbl...
I'm trying to find out how to INCLUDE a file (text or html
etc) into my ASPX page.
I don't want to know how to create a user control etc just
a quick simple example.

Looking for something similar to the old fashioned ASP
include <!--#include file="time.inc"--> but a .NET version.

Hmmm, UserControls ARE the .NET version of how this is done, yet you DON'T
want that?!

Could you tell me how to put 10 gallons of water into a 5 gallon bucket all
at once please?
Jul 21 '05 #2
Traditional #include is nit really a good option for the OO nature of
asp.net. The correct approach is to use user controls, but they can be very
simple to implement.

Add this line to the top of your aspx page
includeme.ascx is the equivalent of the old include file with your HTML
etc, in my case it is a navigation menu

<%@ Register TagPrefix="myProject" TagName="includedthing"
Src="includeme.ascx" %>

To position the include file in the page add the line below to you ASPX
page

<myProject:menu:includedthing ID="myfirstinclude" runat="server" />

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Bari" <ba****@hotmail.com> wrote in message
news:03****************************@phx.gbl...
I'm trying to find out how to INCLUDE a file (text or html
etc) into my ASPX page.
I don't want to know how to create a user control etc just
a quick simple example.

Looking for something similar to the old fashioned ASP
include <!--#include file="time.inc"--> but a .NET version.

Jul 21 '05 #3
Or better yet, in VS.NET, just drag the UserControl (.ascx file) on to the
host page at the desired location and you are done!
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Traditional #include is nit really a good option for the OO nature of
asp.net. The correct approach is to use user controls, but they can be very simple to implement.

Add this line to the top of your aspx page
includeme.ascx is the equivalent of the old include file with your HTML
etc, in my case it is a navigation menu

<%@ Register TagPrefix="myProject" TagName="includedthing"
Src="includeme.ascx" %>

To position the include file in the page add the line below to you ASPX
page

<myProject:menu:includedthing ID="myfirstinclude" runat="server" />

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Bari" <ba****@hotmail.com> wrote in message
news:03****************************@phx.gbl...
I'm trying to find out how to INCLUDE a file (text or html
etc) into my ASPX page.
I don't want to know how to create a user control etc just
a quick simple example.

Looking for something similar to the old fashioned ASP
include <!--#include file="time.inc"--> but a .NET version.


Jul 21 '05 #4
that would indeed do it in vs.net..........(old hardcore developers like me
like to do it the old fashioned way - notepad and the SDK )

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Scott M." <s-***@BADSPAMsnet.net> wrote in message
news:#Y**************@TK2MSFTNGP09.phx.gbl...
Or better yet, in VS.NET, just drag the UserControl (.ascx file) on to the
host page at the desired location and you are done!
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Traditional #include is nit really a good option for the OO nature of
asp.net. The correct approach is to use user controls, but they can be

very
simple to implement.

Add this line to the top of your aspx page
includeme.ascx is the equivalent of the old include file with your HTML
etc, in my case it is a navigation menu

<%@ Register TagPrefix="myProject" TagName="includedthing"
Src="includeme.ascx" %>

To position the include file in the page add the line below to you ASPX
page

<myProject:menu:includedthing ID="myfirstinclude" runat="server" />

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Bari" <ba****@hotmail.com> wrote in message
news:03****************************@phx.gbl...
I'm trying to find out how to INCLUDE a file (text or html
etc) into my ASPX page.
I don't want to know how to create a user control etc just
a quick simple example.

Looking for something similar to the old fashioned ASP
include <!--#include file="time.inc"--> but a .NET version.



Jul 21 '05 #5
I am also an "old hardcore", "Visual" Notepad using developer, but if I can
find a way for VS to generate the exact same (emphasis on "exact same") code
that I would have had to have written, I'll take it!
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
that would indeed do it in vs.net..........(old hardcore developers like me like to do it the old fashioned way - notepad and the SDK )

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Scott M." <s-***@BADSPAMsnet.net> wrote in message
news:#Y**************@TK2MSFTNGP09.phx.gbl...
Or better yet, in VS.NET, just drag the UserControl (.ascx file) on to the host page at the desired location and you are done!
"John Timney (Microsoft MVP)" <ti*****@despammed.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Traditional #include is nit really a good option for the OO nature of
asp.net. The correct approach is to use user controls, but they can be
very
simple to implement.

Add this line to the top of your aspx page
includeme.ascx is the equivalent of the old include file with your

HTML etc, in my case it is a navigation menu

<%@ Register TagPrefix="myProject" TagName="includedthing"
Src="includeme.ascx" %>

To position the include file in the page add the line below to you ASPX page

<myProject:menu:includedthing ID="myfirstinclude" runat="server" />

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Bari" <ba****@hotmail.com> wrote in message
news:03****************************@phx.gbl...
> I'm trying to find out how to INCLUDE a file (text or html
> etc) into my ASPX page.
> I don't want to know how to create a user control etc just
> a quick simple example.
>
> Looking for something similar to the old fashioned ASP
> include <!--#include file="time.inc"--> but a .NET version.
>



Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: Martin Walke | last post by:
Hi, This may seem like a client side problem but.... I have web pages that are made up of a number of javascript include files as well as 'in page' script. They all work fine running locally...
12
by: tshad | last post by:
I am not sure why I am getting this error: I have the following code I want to run from another include file that holds all my functions. functions.inc...
6
by: William F. Zachmann | last post by:
We've got a project going that involves moving an old web site with a massive dll written in C++ that produces most of the output from a SQL 7.0 data base on NT4 onto IIS on Windows 2003 Server...
5
by: Bari | last post by:
I'm trying to find out how to INCLUDE a file (text or html etc) into my ASPX page. I don't want to know how to create a user control etc just a quick simple example. Looking for something...
1
by: stephan.j.bird | last post by:
Hi, I tried serverside includes to try and alter some text on a web page I'm authoring, with the below: <!--#config timefmt="%j" --> <P CLASS="motd centre"> <!--#if expr="\"$DATE_GMT\" < 10"...
9
by: brett | last post by:
I have a main aspx file for my site and use web controls as includes for content. The url may look like this: www.abc.com/main.aspx?page1 I'd like to store content in a text file and...
6
by: MaiyaHolliday | last post by:
Hello, I've recently installed apache on a new computer, and cannot figure out why my site will not process any includes. (it was working on my old one) There are no errors on the page such as...
1
by: Xah Lee | last post by:
Text Processing with Emacs Lisp Xah Lee, 2007-10-29 This page gives a outline of how to use emacs lisp to do text processing, using a specific real-world problem as example. If you don't know...
47
by: mukeshrasm | last post by:
Hi I am calling two pages using Ajax Get_Pages.php and Get_Content.php from combo box. Both pages are displayed based on selection from combo box. Main problem is that it is not showing the...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.