In article <11**********************@m79g2000cwm.googlegroups .com>,
xk****@gmail.com writes
>Probably in the future Master Pages in .net will come up with more
flexibility. In my case (still, I might be wrong) I wasn't able to get to the
point to consider them really useful. I will probably stick with page
inheritance / placeholder control.
No, I think you need to think more about how master pages work. Your
example is perfect for them, it's your understanding of how they work
that's flawed (if you'll pardon me for saying so).
Your problem seems to be that you have defined three content place
holders in the master, one for the header, one for the content and one
for the footer. The whole purpose of the master page is that the common
parts of the page, in your case meaning the header and footer, go *in*
the master page itself. You only have a content place holder for parts
of the page that will differ, ie the content.
Create a master page like the one you showed, but replace the
ContentHeader placeholder with the actual header HTML. Similarly,
replace the ContentFooter placeholder with the actual HTML for the
footer. Then, each individual .aspx file only needs a content control
for the actual content. An example follows...
<%@ Master Language="VB" CodeFile="MasterPage.master.vb"
Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server" <title>Untitled Page</title</head>
<body>
<form id="form1" runat="server">
<table width="100%">
<tr>
<td>
<!-- header stuff goes here... -->
<h1>Fred's Ferrets Limited</h1>
<h2>The best ferrets on the web!!</h2>
</td>
</tr>
<tr>
<td>
<asp:contentplaceholder id="ContentPlaceHolder" runat="server">
</asp:contentplaceholder>
</td>
</tr>
<tr>
<td>
<!-- footer stuff goes here... -->
<p>Web site and content ©1923 by Fred</p>
</td>
</tr>
</table>
</form>
</body>
</html>
I hope this makes it clear. What you are doing is a classic example of
what master pages were designed for, and I would hate to see you reject
them based on a misunderstanding of how they work.
HTH
P.S. You really shouldn't be using tables to layout pages. That is a way
outdated way of doing it and bloats your pages unnecessarily. Use CSS
instead and you'll find your pages are more accessible, lighter and
significantly better seen by the search engines.
--
Alan Silver
(anything added below this line is nothing to do with me)