Tip

Master Pages in ASP.NET 2.0 drive uniform design

ASP.NET 2.0 offers many well-documented enhancements, from security controls and site administration tools to, of course, code reductions. For anyone building a complex Web application for customers or employees, the most notable improvements can be found in the page framework. Here Microsoft has gone to great lengths to ensure that developers need to build something once and only once.

The Master Page construction aptly reflects this notion. A master page consists of common content, such as the banner across the top of a Web application, and a spot for content placeholders. (Content pages, conversely, reference master pages and fill the placeholders.)

"User interface design is left to the designers," said Patrick Hynds, CTO, CriticalSites, during a demo at Microsoft Launch event in Boston. "It's not something we have to wrap our minds around every day."

As outlined in the MSDN article Master Pages in ASP.NET 2.0, content pages have the same .aspx extension as typical ASP.NET files.

More on ASP.NET 2.0 development

ASP.NET 2.0 Learning Guide

ASP.NET 2.0 provides cleaner, developer-friendly coding

How to Use Master Pages -- Chapter 3 of Murach's ASP.NET 2.0 Upgrader's Guide, VB Edition

There are a couple differences, though. Everything on a content page needs to be contained within Content controls, which map content areas on the pages to the appropriate areas marked by a master page's ContentPlaceHolder control. In addition, a content page has to be associated with a Master Page through an attribute of the <%@ Page %> directive.

Content development gains a few timesavers, too, as Tony Pino of the Boston .NET User Group demonstrated when the group met in January. The easiest way to control and update an app, Pino said, is through themes.

Themes consist of a style sheet, images and a skin file, which defines styles for a specific server control (like the width of a text box) but does not affect the overall design of a Web app. Skins work well for defining advanced controls and collections and for displaying foreground images that can't be controlled by cascading style sheets, as Jeff King explained at Tech Ed.

Themes can be defined on a per-page basis, and a developer can always override a page's theme, Pino said. Also keep in mind that themes should not include global images or style sheets such as Print or Shared.

This MSDN article by Stephen Walther, Creating Web Application Themes in ASP.NET 2.0, offers more insight into constructing themes, deploying skins and incorporating both into cascading style sheets.

This was first published in January 2006

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.