An Overview of ASP.NET's Site Navigation FeaturesPrior to ASP.NET 2.0, a very common and very time-consuming task for developers was defining their website's structure and implementing the site's navigation. Some developers simply hard-coded their site's structure within the navigational elements; others created database tables or used files to store the site's structure. Developers were left on their own for turning the site's structure into a coherent navigation. Although a number of third-party navigation components were availablemenus, treeviews, breadcrumbs, and the likethere were no built-in ASP.NET Web controls. Fortunately, these are concerns of the past. ASP.NET now provides a means to specify site structure by creating a site map. The site map is an XML file that defines the logical sections of the site and optionally ties each section to a particular URL. After the site map has been defined, a number of new ASP.NET Web controls can be used to turn the site's structure into a navigation user interface.
ASP.NET version 2.0 provides three new navigation Web controls:
Because the navigation Web controls' contents are rendered based on the page being visited and the site structure defined in the site map, updating the site map immediately updates the navigation controls used throughout the site. That is, if you want to add a new section to your website, simply create the appropriate ASP.NET pages and then tie those new pages into the site map. As soon as these changes are made and saved, the navigation Web controls used throughout the sitethe breadcrumbs, treeviews, and menuswill automatically be updated to include this new section. Before we can start using the navigation Web controls, we'll first need to define our website's structure using a site map. In the next section we'll create the site map file. In the sections after that, we'll examine each of ASP.NET's three navigation Web controls. |