One common characteristic of userfriendly websites is that they have a consistent, sitewide page layout and navigation scheme. ASP.NET 2.0 introduces two new features that greatly simplify implementing both a sitewide page layout and navigation scheme: master pages and site navigation. Master pages allow for developers to create a sitewide template with designated editable regions. This template can then be applied to ASP.NET pages in the site. Such ASP.NET pages need only provide content for the master page's specified editable regions – all other markup in the master page is identical across all ASP.NET pages that use the master page. This model allows developers to define and centralize a sitewide page layout, thereby making it easier to create a consistent look and feel across all pages that can easily be updated.
As web developers, our lives revolve around working with data. We create databases to store the data, code to
retrieve and modify it, and web pages to collect and summarize it. This is the first tutorial in a lengthy series
that will explore techniques for implementing these common patterns in ASP.NET 2.0. We'll start with creating
a software architecture composed of a Data Access Layer (DAL) using Typed DataSets, a Business Logic Layer
(BLL) that enforces custom business rules, and a presentation layer composed of ASP.NET pages that share a
common page layout. Once this backend groundwork has been laid, we'll move into reporting, showing how to
display, summarize, collect, and validate data from a web application. These tutorials are geared to be concise
and provide stepbystep instructions with plenty of screen shots to walk you through the process visually. Each
tutorial is available in C# and Visual Basic versions and includes a download of the complete code used. (This
first tutorial is quite lengthy, but the rest are presented in much more digestible chunks.)
The Data Access Layer (DAL) created in the first tutorial cleanly separates the data access logic from the presentation logic. However, while the DAL cleanly separates the data access details from the presentation layer, it does not enforce any business rules that may apply. For example, for our application we may want to disallow the CategoryID or SupplierID fields of the Products table to be modified when the Discontinued field is set to 1, or we might want to enforce seniority rules, prohibiting situations in which an employee is managed by someone who was hired after them. Another common scenario is authorization – perhaps only users in a particular role can delete products or can change the UnitPrice value.
As we saw in the preceding tutorial, the DataList offers a number of stylerelated properties that affect its appearance. In particular, we saw how to assign default CSS classes to the DataList’s HeaderStyle, ItemStyle, AlternatingItemStyle, and SelectedItemStyle properties. In addition to these four properties, the DataList includes a number of other stylerelated properties, such as Font, ForeColor, BackColor, and BorderWidth, to name a few. The Repeater control does not contain any stylerelated properties. Any such style settings must be
made directly within the markup in the Repeater’s templates.