After having done now two applications using master pages they still feel very odd to me. In fact that feel very ... backwards.
I have been developing ASP.NET apps using dynamic control placement based templating for quite some time now (oddly enough I do my windows forms apps the same way). Its great, I have things such as a tab strip control which loads plugins, automatic menu creation, etc. In this model it is parent who is told to run the child, the parent then decides how and where to display the child. The child is completely oblivious of its relationship with its parent with the exception of an interface IControlHost which it uses to interact with its parent.
In master pages the exact opposite is true here is a quick example if you are not familiar shamelessly copy/pasted from a intro to master pages article.
<%@ page language="C#" master="~/Intro.master" %>
<script runat="server">
void Page_Load(object sender,
System.EventArgs e)
{
lblMessage.Text = "This content is
generated from the content page";
}
</script>
<asp:content id="Content1" contentplaceholderid="middleContent" runat="server">
<asp:label runat="server"
id="lblMessage"></asp:label>
</asp:content>
<%@ master language="C#" %>
<html>
<head id="Head1" runat="server">
<title>Master Page</title>
</head>
<body>
<form id="Form1" runat="server">
<table id="header" style="WIDTH: 100%; HEIGHT:
80px" cellspacing="1" cellpadding="1" border="1">
<tr>
<td width="100%" style="TEXT-
ALIGN: center">
<asp:label runat="server" id="Header">
This is the default header in the Master
Page</asp:label>
</td>
</tr>
</table>
<b/>
<table id="leftNav" style="WIDTH: 108px;
HEIGHT: 100%" cellspacing="1" cellpadding="1"
border="1">
<tr>
<td style="WIDTH: 100px"> Left
Navigation
</td>
</tr>
</table>
<table id="mainBody" style="LEFT: 120px; VERTICAL-
ALIGN: top; WIDTH: 848px; POSITION: absolute; TOP:
94px; HEIGHT: 100%" border="1">
<tr>
<td width="100%"
style="VERTICAL-ALIGN: top">
<asp:contentplaceholder
id="middleContent"
runat="Server">
</asp:contentplaceholder>
</td>
</tr>
</table>
</form>
</body>
</html>
The key is that the child is defining the content placement on the parent. This still offers alot of flexibility for changing interfaces etc and is by far the easier of the two solutions, but what happens if I have two seperate master pages which treat containers differently? The children are directly coupled to the containers on the parent, I can't do this. I end up with a weird hack of layering master pages in order to provide the behavior I need.
The master pages is definately more accessible to the average programmer, and is far better suited for the weekend warriors who create aspx based web pages (i.e. not even writing code behinds). But is this really a good methodology for enterprise level development?!
I am intrested in other's take on this.