6.6. Summary

ASP.NET 3.5 offers a number of great tools to aid you in creating a consistent looking web site. A consistent look and feel of all pages in your site is important to give your site a professional and attractive look. This in turn helps your visitors in finding the right information in your site, increasing the chances that they might visit your site again.

The best way to start creating consistent sites is by using a master page. With a master page, you can define the global look and feel of pages, adding relatively static items like a header and footer directly in it, and creating room with the ContentPlaceHolder controls for content pages to fill in.

A content page is then hooked up to this master page using the MasterPageFile attribute on the @ Page directive. The only thing that the content page needs to define is an <asp:Content> region for every <asp:ContentPlaceHolder> in the master page that it wants to override. There is no need to include repeating content like headers, footers, or menus in the content page, freeing you from making repetitious changes to all your content pages if you want to change the layout of your site.

Whereas master pages and content pages are used to define the global layout of a page in terms of the different content regions that your pages have, themes are used to change the look of these elements. Since themes can contain CSS files, images, and skins, you can change colors, fonts, positioning, and images simply by applying a theme. ...

Get Beginning ASP.NET 3.5: In C# and VB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.