473,414 Members | 1,636 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,414 software developers and data experts.

page templates driving me to the brink of suicide

I'm trying to use page inheritance so that I can derive all web pages from a
template. There are a bunch of examples at this site
http://authors.aspalliance.com/PaulW...Articles/?id=1, but strangely
enough, not a single one works with my design.

My format is quite simple: large table direcly under the <HTML> tag contains
a header usercontrol, a left side menu usercontrol and then page content.
Here is a simplified representation of my template design (you should be
able to paste this into a blank html doc):

<%@ Page language="c#" Codebehind="Template.aspx.cs" AutoEventWireup="false"
Inherits="StemCellPolitics._Template" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="_Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Menu" Src="_Menu.ascx" %>
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<TITLE>Default</TITLE>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body>
<table id="tbl" cellSpacing="0" cols="3" cellPadding="0" width="800"
border="0">
<tr>
<td colSpan="3">
<uc1:header id="Header1" runat="server"></uc1:header></td>
</tr>
<tr>
<td vAlign="top" width="145"><uc1:menu id="Menu1"
runat="server"></uc1:menu><img height="1" src="images/1x1.gif" width="145">
</td>
<td width="20"></td>
<td valign="top">
<table cellSpacing="0" cellPadding="0" width="100%" border="0"
ID="Table1">
<TBODY>
<tr>
<td vAlign="middle" width="100%" class="PageHeading">
<!-- Page Title Goes Here-->
<hr>
<br>
</td>
</tr>
<tr>
<td>
<!-- Page Content Goes Here-->
</td>
</tr>
</table>
</td>
</tr>
</TBODY></table>
</body>
</HTML>

I have not found a technique that allows me to load the above HTML, then
load the page content, and then continue building the page HTML. Any
suggestions?

Nov 18 '05 #1
6 1355
I would not recommend tables for layout, look at CCS (yes, it does loads
more than colours and fonts)

but todo this you could put your template in a server control and make it
'contain' the real webpage, I have done this with the app I am working on
now, I have a DIV in the middle and I add controls to this DIV.

Steve
"Mitch" <mi***@somew321here.com> wrote in message
news:3f**********@newspeer2.tds.net...
I'm trying to use page inheritance so that I can derive all web pages from a template. There are a bunch of examples at this site
http://authors.aspalliance.com/PaulW...Articles/?id=1, but strangely
enough, not a single one works with my design.

My format is quite simple: large table direcly under the <HTML> tag contains a header usercontrol, a left side menu usercontrol and then page content.
Here is a simplified representation of my template design (you should be
able to paste this into a blank html doc):

<%@ Page language="c#" Codebehind="Template.aspx.cs" AutoEventWireup="false" Inherits="StemCellPolitics._Template" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="_Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Menu" Src="_Menu.ascx" %>
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<TITLE>Default</TITLE>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body>
<table id="tbl" cellSpacing="0" cols="3" cellPadding="0" width="800"
border="0">
<tr>
<td colSpan="3">
<uc1:header id="Header1" runat="server"></uc1:header></td>
</tr>
<tr>
<td vAlign="top" width="145"><uc1:menu id="Menu1"
runat="server"></uc1:menu><img height="1" src="images/1x1.gif" width="145"> </td>
<td width="20"></td>
<td valign="top">
<table cellSpacing="0" cellPadding="0" width="100%" border="0"
ID="Table1">
<TBODY>
<tr>
<td vAlign="middle" width="100%" class="PageHeading">
<!-- Page Title Goes Here-->
<hr>
<br>
</td>
</tr>
<tr>
<td>
<!-- Page Content Goes Here-->
</td>
</tr>
</table>
</td>
</tr>
</TBODY></table>
</body>
</HTML>

I have not found a technique that allows me to load the above HTML, then
load the page content, and then continue building the page HTML. Any
suggestions?

Nov 18 '05 #2
IMHO, I've found that using PlaceHolder controls much easier...

HTH,
Bill P.
"Mitch" <mi***@somew321here.com> wrote in message
news:3f**********@newspeer2.tds.net...
I'm trying to use page inheritance so that I can derive all web pages from a template. There are a bunch of examples at this site
http://authors.aspalliance.com/PaulW...Articles/?id=1, but strangely
enough, not a single one works with my design.

My format is quite simple: large table direcly under the <HTML> tag contains a header usercontrol, a left side menu usercontrol and then page content.
Here is a simplified representation of my template design (you should be
able to paste this into a blank html doc):

<%@ Page language="c#" Codebehind="Template.aspx.cs" AutoEventWireup="false" Inherits="StemCellPolitics._Template" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="_Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Menu" Src="_Menu.ascx" %>
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<TITLE>Default</TITLE>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body>
<table id="tbl" cellSpacing="0" cols="3" cellPadding="0" width="800"
border="0">
<tr>
<td colSpan="3">
<uc1:header id="Header1" runat="server"></uc1:header></td>
</tr>
<tr>
<td vAlign="top" width="145"><uc1:menu id="Menu1"
runat="server"></uc1:menu><img height="1" src="images/1x1.gif" width="145"> </td>
<td width="20"></td>
<td valign="top">
<table cellSpacing="0" cellPadding="0" width="100%" border="0"
ID="Table1">
<TBODY>
<tr>
<td vAlign="middle" width="100%" class="PageHeading">
<!-- Page Title Goes Here-->
<hr>
<br>
</td>
</tr>
<tr>
<td>
<!-- Page Content Goes Here-->
</td>
</tr>
</table>
</td>
</tr>
</TBODY></table>
</body>
</HTML>

I have not found a technique that allows me to load the above HTML, then
load the page content, and then continue building the page HTML. Any
suggestions?

Nov 18 '05 #3
OK, I have done this and to get EVERY bit of this to work like you want, it may take some work.

I have a PageTemplate class which inherits from Page, and then my pages inherit from it.
What it does is
Creates a Form control,
Removes ALL the controls from the page's Controls collection, strips out certain values and holds them temporarily,
Creates a Table control
Loads UserControls (which are specified through properties at design time) for a banner, menu, and left column into cells of the Table,
Takes all the held Controls and adds them to the Table cell that displays the content of the page,
Adds the cells (banner, menu, left column, content) to the Table,
Adds the Table to the Form,
then RENDERS IT ALL!!! :)

'Build my new controls from scratch

'(FORM)
'
' Template Table
' |---------------------|
' | Banner |
' |---------------------|
' | Menu |
' \---------------------\ |-----|-------------|
' \ \ | Le | Content |
' \ \ | ft | |
' \ Content subtable --\----> | | (Control |
' \ \ | Col | Collection) |
' \ \ | umn | |
' \---------------------\ |-----|-------------|

I remove all the controls from the existing page, then add them to my class' form because if I just added the page's content to my table and rendered the table, the form would only contain what whas in the page, making any active content in the template pieces impossible.

Does this sound like something you're trying to do? If so, reply back to this thread.

"Mitch" <mi***@somew321here.com> wrote in message news:3f**********@newspeer2.tds.net...
I'm trying to use page inheritance so that I can derive all web pages from a
template. There are a bunch of examples at this site
http://authors.aspalliance.com/PaulW...Articles/?id=1, but strangely
enough, not a single one works with my design.

My format is quite simple: large table direcly under the <HTML> tag contains
a header usercontrol, a left side menu usercontrol and then page content.
Here is a simplified representation of my template design (you should be
able to paste this into a blank html doc):

<%@ Page language="c#" Codebehind="Template.aspx.cs" AutoEventWireup="false"
Inherits="StemCellPolitics._Template" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="_Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Menu" Src="_Menu.ascx" %>
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<TITLE>Default</TITLE>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body>
<table id="tbl" cellSpacing="0" cols="3" cellPadding="0" width="800"
border="0">
<tr>
<td colSpan="3">
<uc1:header id="Header1" runat="server"></uc1:header></td>
</tr>
<tr>
<td vAlign="top" width="145"><uc1:menu id="Menu1"
runat="server"></uc1:menu><img height="1" src="images/1x1.gif" width="145">
</td>
<td width="20"></td>
<td valign="top">
<table cellSpacing="0" cellPadding="0" width="100%" border="0"
ID="Table1">
<TBODY>
<tr>
<td vAlign="middle" width="100%" class="PageHeading">
<!-- Page Title Goes Here-->
<hr>
<br>
</td>
</tr>
<tr>
<td>
<!-- Page Content Goes Here-->
</td>
</tr>
</table>
</td>
</tr>
</TBODY></table>
</body>
</HTML>

I have not found a technique that allows me to load the above HTML, then
load the page content, and then continue building the page HTML. Any
suggestions?


Nov 18 '05 #4
I'm attaching the page template I use. It allows me to design the page,
although you do need to manually delete the header, body and html tags (i.e.
you will only have the content of the page in the HTML view).

I have header and footer custom controls that emit the HTML to define the
header and footer of the page. The ones I use read in a file from disk that
contains the HTML fragments which allows me to easily modify the look of the
page without recompiling.

I will also echo the comment that CSS is a far better choice for layout than
tables. Table should be reserved for presenting tabular data, not
controlling presentation. See www.alistapart.com or http://tinyurl.com/vzf5
(link to Amazon.com).

Colin

"Mitch" <mi***@somew321here.com> wrote in message
news:3f**********@newspeer2.tds.net...
I'm trying to use page inheritance so that I can derive all web pages from a template. There are a bunch of examples at this site
http://authors.aspalliance.com/PaulW...Articles/?id=1, but strangely
enough, not a single one works with my design.

My format is quite simple: large table direcly under the <HTML> tag contains a header usercontrol, a left side menu usercontrol and then page content.
Here is a simplified representation of my template design (you should be
able to paste this into a blank html doc):

<%@ Page language="c#" Codebehind="Template.aspx.cs" AutoEventWireup="false" Inherits="StemCellPolitics._Template" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="_Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Menu" Src="_Menu.ascx" %>
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<TITLE>Default</TITLE>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body>
<table id="tbl" cellSpacing="0" cols="3" cellPadding="0" width="800"
border="0">
<tr>
<td colSpan="3">
<uc1:header id="Header1" runat="server"></uc1:header></td>
</tr>
<tr>
<td vAlign="top" width="145"><uc1:menu id="Menu1"
runat="server"></uc1:menu><img height="1" src="images/1x1.gif" width="145"> </td>
<td width="20"></td>
<td valign="top">
<table cellSpacing="0" cellPadding="0" width="100%" border="0"
ID="Table1">
<TBODY>
<tr>
<td vAlign="middle" width="100%" class="PageHeading">
<!-- Page Title Goes Here-->
<hr>
<br>
</td>
</tr>
<tr>
<td>
<!-- Page Content Goes Here-->
</td>
</tr>
</table>
</td>
</tr>
</TBODY></table>
</body>
</HTML>

I have not found a technique that allows me to load the above HTML, then
load the page content, and then continue building the page HTML. Any
suggestions?

Nov 18 '05 #5
Here is a link to an article that talks about a different approach to
creating page templates:
http://www.smartisans.com/articles/vb_templates.aspx

This approach is similar to the Master Pages concept MS is creating in
ASP.NETv2.

Jeff
"Colin Young" <x@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I'm attaching the page template I use. It allows me to design the page,
although you do need to manually delete the header, body and html tags (i.e. you will only have the content of the page in the HTML view).

I have header and footer custom controls that emit the HTML to define the
header and footer of the page. The ones I use read in a file from disk that contains the HTML fragments which allows me to easily modify the look of the page without recompiling.

I will also echo the comment that CSS is a far better choice for layout than tables. Table should be reserved for presenting tabular data, not
controlling presentation. See www.alistapart.com or http://tinyurl.com/vzf5 (link to Amazon.com).

Colin

"Mitch" <mi***@somew321here.com> wrote in message
news:3f**********@newspeer2.tds.net...
I'm trying to use page inheritance so that I can derive all web pages from
a
template. There are a bunch of examples at this site
http://authors.aspalliance.com/PaulW...Articles/?id=1, but strangely
enough, not a single one works with my design.

My format is quite simple: large table direcly under the <HTML> tag

contains
a header usercontrol, a left side menu usercontrol and then page

content. Here is a simplified representation of my template design (you should be
able to paste this into a blank html doc):

<%@ Page language="c#" Codebehind="Template.aspx.cs"

AutoEventWireup="false"
Inherits="StemCellPolitics._Template" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="_Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Menu" Src="_Menu.ascx" %>
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<TITLE>Default</TITLE>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body>
<table id="tbl" cellSpacing="0" cols="3" cellPadding="0" width="800"
border="0">
<tr>
<td colSpan="3">
<uc1:header id="Header1" runat="server"></uc1:header></td>
</tr>
<tr>
<td vAlign="top" width="145"><uc1:menu id="Menu1"
runat="server"></uc1:menu><img height="1" src="images/1x1.gif"

width="145">
</td>
<td width="20"></td>
<td valign="top">
<table cellSpacing="0" cellPadding="0" width="100%" border="0"
ID="Table1">
<TBODY>
<tr>
<td vAlign="middle" width="100%" class="PageHeading">
<!-- Page Title Goes Here-->
<hr>
<br>
</td>
</tr>
<tr>
<td>
<!-- Page Content Goes Here-->
</td>
</tr>
</table>
</td>
</tr>
</TBODY></table>
</body>
</HTML>

I have not found a technique that allows me to load the above HTML, then
load the page content, and then continue building the page HTML. Any
suggestions?


Nov 18 '05 #6
I guess they took a look at the proliferation of articles on creating page
templates and decided they had better do something about it.

That article has a good set of links at the end to other articles on page
templates. I used information from almost all of them to come up with my
solution.

Colin

"Jeff" <js****@nospam.dls.net> wrote in message
news:OI**************@TK2MSFTNGP11.phx.gbl...
Here is a link to an article that talks about a different approach to
creating page templates:
http://www.smartisans.com/articles/vb_templates.aspx

This approach is similar to the Master Pages concept MS is creating in
ASP.NETv2.

Jeff
"Colin Young" <x@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I'm attaching the page template I use. It allows me to design the page,
although you do need to manually delete the header, body and html tags

(i.e.
you will only have the content of the page in the HTML view).

I have header and footer custom controls that emit the HTML to define the
header and footer of the page. The ones I use read in a file from disk

that
contains the HTML fragments which allows me to easily modify the look of

the
page without recompiling.

I will also echo the comment that CSS is a far better choice for layout

than
tables. Table should be reserved for presenting tabular data, not
controlling presentation. See www.alistapart.com or

http://tinyurl.com/vzf5
(link to Amazon.com).

Colin

"Mitch" <mi***@somew321here.com> wrote in message
news:3f**********@newspeer2.tds.net...
I'm trying to use page inheritance so that I can derive all web pages

from
a
template. There are a bunch of examples at this site
http://authors.aspalliance.com/PaulW...Articles/?id=1, but strangely enough, not a single one works with my design.

My format is quite simple: large table direcly under the <HTML> tag

contains
a header usercontrol, a left side menu usercontrol and then page

content. Here is a simplified representation of my template design (you should be able to paste this into a blank html doc):

<%@ Page language="c#" Codebehind="Template.aspx.cs"

AutoEventWireup="false"
Inherits="StemCellPolitics._Template" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="_Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Menu" Src="_Menu.ascx" %>
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<TITLE>Default</TITLE>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body>
<table id="tbl" cellSpacing="0" cols="3" cellPadding="0" width="800"
border="0">
<tr>
<td colSpan="3">
<uc1:header id="Header1" runat="server"></uc1:header></td>
</tr>
<tr>
<td vAlign="top" width="145"><uc1:menu id="Menu1"
runat="server"></uc1:menu><img height="1" src="images/1x1.gif"

width="145">
</td>
<td width="20"></td>
<td valign="top">
<table cellSpacing="0" cellPadding="0" width="100%" border="0"
ID="Table1">
<TBODY>
<tr>
<td vAlign="middle" width="100%" class="PageHeading">
<!-- Page Title Goes Here-->
<hr>
<br>
</td>
</tr>
<tr>
<td>
<!-- Page Content Goes Here-->
</td>
</tr>
</table>
</td>
</tr>
</TBODY></table>
</body>
</HTML>

I have not found a technique that allows me to load the above HTML, then load the page content, and then continue building the page HTML. Any
suggestions?



Nov 18 '05 #7

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

Similar topics

0
by: jason.davis | last post by:
Early this morning Arnold Schwarzenegger was found hanging by his neck from the large oak tree in his Californian garden. In a suicide note found at the scene he tells of his sordid sex life and...
1
by: Barry Anderberg | last post by:
I have an XML document that I am trying to display in my ASP.NET page. I am using an XSL Transform to display repeating XML data in a specific format. It reads the data, and displays it on my...
0
by: thomas | last post by:
I was wandering if theres a way to make a .xsl page output 20 results per page. My page transforms an .xml file but as its a large file, it outputs hundreds of results on the same page. heres my...
5
by: Glenn Mulno | last post by:
Hi, I am trying to create a report page for several teams. Each team runs the same reports but the reports use different values. For a while this was getting insane everytime I updated the...
0
by: vinki | last post by:
Hi Everyone, I have this xslt file. I want to print the page directly to the printer after every MOP template is matched. So for example the ouput is coming to the HTML page like this ...
1
by: vinki | last post by:
Hi Everyone, I have this xslt file. I want to print the page directly to the printer after every MOP template is matched. So for example the ouput is coming to the HTML page like this ...
13
by: Justin.Voelker | last post by:
Hello Everyone: I am in search of an easier way to develop pages. My most current website, www.Base2WebDesign.com, has the exact same layout throughout the entire site. Right now I use a...
8
by: Malciah | last post by:
I posted this on another site, but so far I've had no answers. So, I decided to try it here. -------------------------------------------------------- I've been learning C++ for about 6 weeks now,...
104
by: JohnQ | last post by:
Well apparently not since one can step thru template code with a debugger. But if I was willing to make the concession on debugging, templates would be strictly a precompiler thing? I have a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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
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,...
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.