6.5. Practical Tips on Creating Consistent Pages

The following list provides some practical tips on creating consistent pages.

  • When you create a new web site, always start by adding a master page that you base all other pages on. Even if you think you have a site with only a few pages, a master page will help you ensure a consistent look across the entire site. Adding a master page at a later stage to the site means making a lot of manual changes to the existing pages, so adding one from the beginning saves you from having to do a lot of work later.

  • As soon as you find yourself adding styling information to complex controls like the TreeView and Menu (discussed in the next chapter) or data-aware controls like the GridView (discussed in Chapter 12), consider creating a skin for them. The fact that you can control the layout of all similar controls from a single location makes it a lot easier to update your site. If you want to override the layout for a few controls, you can always use named skins with a SkinID or disable the skin entirely by setting EnableTheming to False.

  • When creating skins or setting style properties directly on a control, consider using the CssClass property instead, and then moving all styling-related properties to the CSS for the site or theme. This decreases the page's size and makes it easier to make changes to the layout afterwards.

  • The Export Template feature of Visual Web Developer is a great time saver. You can use it not only to create a template for ...

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.