Introduced in ASP.NET 2.0 (released Nov. 7, 2005), Master Pages provides a template-based approach to web page design. Master Pages is the next generation to templates.
Templates
Traditional DreamWeaver or FrontPage web templates (.dwt files) provide a framework of HTML that is common to every page using a particular template on a web site; headers, footers or navigation menus. This allows the web author to easily insert new content into placeholder sections (Editable Regions) within the template when designing a new page. The authoring tools detect when a template is changed and prompt the author to modify all pages based on that template. The advantage of using a template-based web site is that changes to the template are propagated to all pages using that template. However, ALL of those changed pages still need released to the live web site. Also, it's easy to inadvertently change an uneditable region on a template-based page which would get overwritten the next time the template is applied.
Master Pages
Similar to using an editable region placeholder in a template, Master Pages (.master files) use a ContentPlaceHolder control. HTML or controls are then placed in this region when authoring a new page:
<asp:Content id="content1" runat="server" contentplaceholderid="content">Testing -- new content goes here</asp:Content>
Unlike with templates, default content can be included in the Master Page within the ContentPlaceHolder control. This can be useful if a default navigation menu is typically used, but may need to change for certain pages. Also unlike templates, the new page based on a Master Page is rendered in the browser at run-time, not during design of the page. So when the Master Page is changed, only the .master file needs released to the live web site.
Stay tuned for Master Pages Part 2 where we'll talk about image paths...
David Heater, P.E.
GrandView Business Solutions Developer