Sams Teach Yourself ASP.NET 2.0 in 24 Hours, Complete Starter Kit
In this hour we saw how to create a site structure and navigation using ASP.NET's new site map and navigation Web controls. The site map is an XML-formatted file that expresses the structural hierarchy of a website. Often it helps to first sketch out the proposed site structure (as we did in Figure 19.3) and then convert the items in the sketch into the appropriate XML elements in the site map file. After the site map file has been created, the three ASP.NET navigation Web controls can be used. The SiteMapPath displays a breadcrumb, showing the user the current page he is visiting and its location in the site structure hierarchy. The TreeView and Menu controls display the entire site map, either in a tree or in a menu. To use either of these controls, you need to first add a SiteMapDataSource control to the page. All three of these controls offer a high degree of customization, making it easy to tailor the appearance of the navigation controls to fit your site's look and feel. Furthermore, there is a clean separation between the navigation controls and the site map, making updating the site's structure a breeze. If you wanted to add a new section to your site or remove some existing sections, you would need to update only the site map file. The navigation controls throughout the site would automatically reflect these changes. |
Категории