473,395 Members | 2,010 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,395 software developers and data experts.

Best Methodology For Creating A Head For Web Page

Hi there,

I am developing a web site with a number of pages, I want each page to have
the same heading section which will include both the raw html and vb.net
code which handle rollovers for some images which will also be included.

My initial feeling on how to do this would be to create a base class web
page and then inherit it with all the HTML response.writing and image
rollover code already there. Problem being that my page already inherits the
System.Web.UI.Page class so I cant do it that way.

What is the recommended way of including the same basic code and html for
each page on a site? Web pages on sites nearly always have the same header
and menu information on each page, how should this be done in a nice proper
OO way?

Hope I haven't opened up a can of worms, I know its a general question with
lots of possible answers but it would be good to be pointed in the right
direction :)
Thanks
Steve

Nov 21 '05 #1
8 1104
Most people just use an include statement and have the code in the \includes
directory.

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
--
"Stephen Adam" <st**********@ntlworld.com> wrote in message
news:%7***************@newsfe2-gui.ntli.net...
Hi there,

I am developing a web site with a number of pages, I want each page to
have
the same heading section which will include both the raw html and vb.net
code which handle rollovers for some images which will also be included.

My initial feeling on how to do this would be to create a base class web
page and then inherit it with all the HTML response.writing and image
rollover code already there. Problem being that my page already inherits
the
System.Web.UI.Page class so I cant do it that way.

What is the recommended way of including the same basic code and html for
each page on a site? Web pages on sites nearly always have the same header
and menu information on each page, how should this be done in a nice
proper
OO way?

Hope I haven't opened up a can of worms, I know its a general question
with
lots of possible answers but it would be good to be pointed in the right
direction :)
Thanks
Steve

Nov 21 '05 #2

"Stephen Adam" <st**********@ntlworld.com> wrote in message
news:%7***************@newsfe2-gui.ntli.net...
Hi there,

I am developing a web site with a number of pages, I want each page to
have
the same heading section which will include both the raw html and vb.net
code which handle rollovers for some images which will also be included.

My initial feeling on how to do this would be to create a base class web
page and then inherit it with all the HTML response.writing and image
rollover code already there. Problem being that my page already inherits
the
System.Web.UI.Page class so I cant do it that way.

Sure you can. Just create your own base Page class inheriting
System.Web.UI.Page, and inherit from that instead.
What is the recommended way of including the same basic code and html for
each page on a site? Web pages on sites nearly always have the same header
and menu information on each page, how should this be done in a nice
proper
OO way?


Page inheritence or Web user controls. See, eg

http://www.codeproject.com/aspnet/page_templates.asp

and

http://msdn.microsoft.com/library/de...ercontrols.asp

David
Nov 21 '05 #3

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Most people just use an include statement and have the code in the
\includes directory.


Include is the old ASP way, and it requires you to put code in your ASPX
files, which is a pain since you don't get intellisense and it doesn't
compile until the user hits it.

Yuck.

David
Nov 21 '05 #4
Stephen,
In addition to the other comments:

I normally use a UserControl, that I manually add to each page.

VS.NET 2005 (aka Whidbey, currently in beta, due out later in 2005) will
support Master Pages which will significantly simplify what you want to do.

For details on VS.NET 2005 see:
http://lab.msdn.microsoft.com/vs2005/

For details on Master Pages see:

http://msdn.microsoft.com/library/de...asterpages.asp

Hope this helps
Jay
"Stephen Adam" <st**********@ntlworld.com> wrote in message
news:%7***************@newsfe2-gui.ntli.net...
Hi there,

I am developing a web site with a number of pages, I want each page to
have
the same heading section which will include both the raw html and vb.net
code which handle rollovers for some images which will also be included.

My initial feeling on how to do this would be to create a base class web
page and then inherit it with all the HTML response.writing and image
rollover code already there. Problem being that my page already inherits
the
System.Web.UI.Page class so I cant do it that way.

What is the recommended way of including the same basic code and html for
each page on a site? Web pages on sites nearly always have the same header
and menu information on each page, how should this be done in a nice
proper
OO way?

Hope I haven't opened up a can of worms, I know its a general question
with
lots of possible answers but it would be good to be pointed in the right
direction :)
Thanks
Steve

Nov 21 '05 #5
Thanks for all the tips guys, i've now created a base web page class which
extends System.Web.UI.Page which is great and everything... But, i've got
all my rollover code in the page_load sub of my base web page class. Now on
many pages i'm going to want to add other bits and bob's to the page_load
sub. How can I do this? You can extend a class but not a method (sub), I
suppose I could over-ride it but then i'd have to enter in all the base
class rollover code again which kinda defeats the object.

Thanks again
Nov 21 '05 #6
LOL, Oh well, never mind, there are other ways like creating your own page
class. Next year you wont have this issue with 2005 but I dont suppose
that's gonna help you right now.

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
--
"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:uq**************@TK2MSFTNGP12.phx.gbl...

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in
message news:%2****************@TK2MSFTNGP15.phx.gbl...
Most people just use an include statement and have the code in the
\includes directory.


Include is the old ASP way, and it requires you to put code in your ASPX
files, which is a pain since you don't get intellisense and it doesn't
compile until the user hits it.

Yuck.

David

Nov 21 '05 #7
Stephen,
Page_Load is an event, you can have multiple event handlers handle the
event. Which means you can have your base page handle it & your derived
pages also handle it.

What I normally do is override the Page.OnLoad method instead, being certain
to call MyBase.OnLoad and do any "event handling" in the OnLoad method.

Page.OnLoad raises the Load event.

I normally override the On<event> methods when I am handling an event
internally in a derived class. I normally handle the <event> when I am
handling an event externally, when the object is contained in another
object.

For details on the relationship between <event> and On<event> see:

The "Design Guidelines for Class Library Developers" has some information on
implementing events in both C# & VB.NET.

http://msdn.microsoft.com/library/de...Guidelines.asp

http://msdn.microsoft.com/library/de...Guidelines.asp

Note: within VB.NET you can simply use RaiseEvent rather then checking to
see if a delegate variable is Nothing and invoking the delegate variable...

Hope this helps
Jay
"Stephen Adam" <st**********@ntlworld.com> wrote in message
news:Y3**************@newsfe2-gui.ntli.net...
Thanks for all the tips guys, i've now created a base web page class which
extends System.Web.UI.Page which is great and everything... But, i've got
all my rollover code in the page_load sub of my base web page class. Now
on
many pages i'm going to want to add other bits and bob's to the page_load
sub. How can I do this? You can extend a class but not a method (sub), I
suppose I could over-ride it but then i'd have to enter in all the base
class rollover code again which kinda defeats the object.

Thanks again

Nov 21 '05 #8
Stephen,

I never did what you ask, however in this I would probably for sure use a
shared class, which will function very well for problems like this in a
webapplication.

The shared class belongs to the application so will be loaded only with the
first page (session) that is used at that time and after can be used for all
pages for every session that is active.

I hope this gives an idea?

Cor
"Stephen Adam" <st**********@ntlworld.com>
Hi there,

I am developing a web site with a number of pages, I want each page to
have
the same heading section which will include both the raw html and vb.net
code which handle rollovers for some images which will also be included.

My initial feeling on how to do this would be to create a base class web
page and then inherit it with all the HTML response.writing and image
rollover code already there. Problem being that my page already inherits
the
System.Web.UI.Page class so I cant do it that way.

What is the recommended way of including the same basic code and html for
each page on a site? Web pages on sites nearly always have the same header
and menu information on each page, how should this be done in a nice
proper
OO way?

Hope I haven't opened up a can of worms, I know its a general question
with
lots of possible answers but it would be good to be pointed in the right
direction :)
Thanks
Steve

Nov 21 '05 #9

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

Similar topics

10
by: James | last post by:
What is the best method for creating a Web Page that uses both PHP and HTML ? <HTML> BLA BLA BLA BLA BLA
41
by: Richard James | last post by:
Are we looking at the scripting world through Python colored glasses? Has Python development been sleeping while the world of scripting languages has passed us Pythonista's by? On Saturday...
1
by: Hasani \(remove nospam\) | last post by:
The way the system works is, you create a user control (ascx) that will be a template and must implement the interface IPageTemplate. You then create one or more user controls (ascx) that implement...
5
by: wrecker | last post by:
Hi all, I have a few common methods that I need to use at different points in my web application. I'm wondering where the best place would be to put these? I think that I have three options. ...
4
by: tshad | last post by:
I am trying to set up an Image authorization where you type in the value that is in a picture to log on to our site. I found a program that is supposed to do it, but it doesn't seem to work. ...
1
by: Luurs | last post by:
Hi All, I've been using a asp-label in the HTML <headsection for quite some time in order to dynamically generate meta-keywords,-description, css and js references. Though the actual...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
29
by: gs | last post by:
let say I have to deal with various date format and I am give format string from one of the following dd/mm/yyyy mm/dd/yyyy dd/mmm/yyyy mmm/dd/yyyy dd/mm/yy mm/dd/yy dd/mmm/yy mmm/dd/yy
9
by: Joe Penora | last post by:
Hi All, How to add the HTML script when creating new ASPX page. After it is done I may need to add some Meta tags etc... but the html script is not there. Is there an option in the ASP.NET...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.