473,498 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what replaces #include in .Net?

As very often is the case a web page has a main, dynamic content page and a
surrounding, more constant "frame" (not html frame!) for stuff like menu,
logo, links etc. In my old ASP web pages I solved this by using #include so
that each .asp page simply started with including this in the top of the
file. Actually it was also ASP code since some of the frame content was
dynamically created from the database.

I can see many possibilities now with .Net to do this but which one would
you suggest?
Nov 18 '05 #1
8 1419
WebControls

"David" <db****@simnet.is> wrote in message
news:un**************@TK2MSFTNGP12.phx.gbl...
As very often is the case a web page has a main, dynamic content page and a surrounding, more constant "frame" (not html frame!) for stuff like menu,
logo, links etc. In my old ASP web pages I solved this by using #include so that each .asp page simply started with including this in the top of the
file. Actually it was also ASP code since some of the frame content was
dynamically created from the database.

I can see many possibilities now with .Net to do this but which one would
you suggest?

Nov 18 '05 #2
Tee
Hi,
There is nothing that really replaces #include, but for your case here and
what you need, the best I think can really replace it is using a placeholder
as a content holder, and code all your content page in web user control.
Then call it out with the following code:

PlaceHolder.Controls.Add(LoadControl"WebUserContro l.ascx"))

HTH,
Tee
"David" <db****@simnet.is> wrote in message
news:un**************@TK2MSFTNGP12.phx.gbl...
As very often is the case a web page has a main, dynamic content page and a surrounding, more constant "frame" (not html frame!) for stuff like menu,
logo, links etc. In my old ASP web pages I solved this by using #include so that each .asp page simply started with including this in the top of the
file. Actually it was also ASP code since some of the frame content was
dynamically created from the database.

I can see many possibilities now with .Net to do this but which one would
you suggest?

Nov 18 '05 #3
use Web User Controls

have a look at
http://msdn.microsoft.com/library/en...ercontrols.asp
and
http://msdn.microsoft.com/library/en...bformspage.asp

--
Hope this helps,
Zeeshan Mustafa, MCSD
"David" <db****@simnet.is> wrote in message
news:un**************@TK2MSFTNGP12.phx.gbl...
As very often is the case a web page has a main, dynamic content page and a surrounding, more constant "frame" (not html frame!) for stuff like menu,
logo, links etc. In my old ASP web pages I solved this by using #include so that each .asp page simply started with including this in the top of the
file. Actually it was also ASP code since some of the frame content was
dynamically created from the database.

I can see many possibilities now with .Net to do this but which one would
you suggest?

Nov 18 '05 #4
ok seems everyone agrees so I'll go for webcontrols :)
also I used to have a global function JScript library for small functions
used on almost every .asp page... this was also included. Is this best
solved using a codeback reference on every .aspx page or is there some other
more global method?
Nov 18 '05 #5
There are two normal reasons for #INCLUDE in ASP.

1. Code used in various pages
2. UI elements

For pure code, stick it in its own class and call that class. For pure
helper methods, make them static (Shared in VB.NET).

For UI elements and/or UI and code, create a control. The easiest to get up
and running quickly is a web user control, or .ascx file.

In 2.0, you can also put common information into master pages to easily
"chrome" your site (menus, et al).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"David" <db****@simnet.is> wrote in message
news:un**************@TK2MSFTNGP12.phx.gbl...
As very often is the case a web page has a main, dynamic content page and a surrounding, more constant "frame" (not html frame!) for stuff like menu,
logo, links etc. In my old ASP web pages I solved this by using #include so that each .asp page simply started with including this in the top of the
file. Actually it was also ASP code since some of the frame content was
dynamically created from the database.

I can see many possibilities now with .Net to do this but which one would
you suggest?

Nov 18 '05 #6
hmm Dimitris I don't agree with you there although I'm pretty new at .Net it
seems to me you are somehow misunderstanding the design... no offence
Nov 18 '05 #7
It would save you a lot of grief to study up on object-oriented,
event-driven programming before continuing any farther with the old
precedural scripted paradigm. Here's a link to the freely-downloadable
Microsoft .Net SDK:

http://www.microsoft.com/downloads/d...displaylang=en

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"David" <db****@simnet.is> wrote in message
news:eH*************@TK2MSFTNGP10.phx.gbl...
ok seems everyone agrees so I'll go for webcontrols :)
also I used to have a global function JScript library for small functions
used on almost every .asp page... this was also included. Is this best
solved using a codeback reference on every .aspx page or is there some other more global method?

Nov 18 '05 #8
"David" <db****@simnet.is> wrote in message
news:un**************@TK2MSFTNGP12.phx.gbl...
As very often is the case a web page has a main, dynamic content page and a surrounding, more constant "frame" (not html frame!) for stuff like menu,
logo, links etc. In my old ASP web pages I solved this by using #include so that each .asp page simply started with including this in the top of the
file. Actually it was also ASP code since some of the frame content was
dynamically created from the database.

I can see many possibilities now with .Net to do this but which one would
you suggest?


User Controls are the closest equivalent to #includes. The nice thing about
them is that they can contain just HTML, or HTML and code. The web designers
can change the HTML with relatively little impact on the code. Just don't
let them change the names of the controls.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #9

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

Similar topics

53
6375
by: Paul Rubin | last post by:
I've been approached about writing a Windows app which will need a really professional looking GUI. Forget TKinter, this has to actually look good (real artists will be available to get the visual...
7
3171
by: Mr B | last post by:
Howdy, I want to set up an Include page in a cell of a table. Then I want to be able to change which page is included on the fly as the user moves the mouse of the various links on the page. ...
10
2442
by: tjgable | last post by:
I have some code that builds fine on .Net 2001(?).. VC++ 7.0. But with gcc 3.42 in MinGW and MS VC++ 6.0 it does not. I can understand VC++ not working, but isn't gcc standard yet? Here is the...
3
1673
by: Epetruk | last post by:
If I have a snippet of javascript code like this: var str = "This is a snippet; str.replace(/ */gi,' '); what should the call to replace do? My actual tests show that it inserts spaces...
4
1996
by: | last post by:
Hello NG! Within a xsl-stylesheet I have an element <xsl:text><!]></xsl:text> If I use that stylesheet to transform some xml-data (to html) with .... pOut = New System.IO.StringWriter
7
1548
by: Bennett Haselton | last post by:
If you create a ASP.Net Web application in Visual Studio .Net, you apparently have to specify the target as a directory on a web server, e.g. www.hostname.com/dirname, with "dirname" being the name...
17
2018
by: zhangyue.zl | last post by:
static void (DEVICE_REQUEST)(void); What does this line declare in C? I am always meeting some codes like this,but I have never learnt that before. It looks like a declaration of a function,but...
7
2135
by: Python.LeoJay | last post by:
dear all, i compiled the following code in VC8.0 and the output was "a < 2", but in fact, the a is 3. why the compiler thought the expression a<2 is true? thanks. #include <iostream>...
7
1432
by: RichB | last post by:
I am just trying to get to grips with C# and OOP, and one of the benefits would seem to be code reuse. However I am not sure where to draw the line. I have the following section of code: if...
0
7124
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
6998
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
7200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7375
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
5460
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4904
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
3090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.