469,623 Members | 1,030 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

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 1225
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

53 posts views Thread by Paul Rubin | last post: by
3 posts views Thread by Epetruk | last post: by
17 posts views Thread by zhangyue.zl | last post: by
7 posts views Thread by Python.LeoJay | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.