O'Reilly logo

Programming ASP.NET, 3rd Edition by Dan Hurwitz, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Navigation

Web sites are becoming larger and more complex. Consequently, developers are called upon to provide navigational hints and menus to keep visitors from “getting lost,” and to enable them to find all the features of the site.

The ASP.NET toolset now includes a number of new controls that facilitate this assistance. There are controls for creating both “bread crumbs” (how did I get to this page?) and site maps (how do I find that other page?).

Most of the time you will want these features to be present on every page, and thus master pages are a great asset. If you change the site map or the control, you only have to update the master and all the other pages are “updated” automatically.

Getting Started with Site Navigation

The most common way to create a site navigation data source is to create an XML file. You can use a database, multiple XML files, and other sources, but for now let’s keep things simple.

To begin, create a new web site called SiteNavigation. Right-click the web site in Solution Explorer and choose Add New Item. The Add New Item dialog box appears. Choose Site map and verify that the name provided is Web.sitemap, as shown in Figure 12-13.

When you click Add, Web.sitemap is added to your web site, and the skeleton of a site map is provided for you, as shown in Example 12-4.

Creating the site map

Figure 12-13. Creating the site map

Example 12-4. Web.sitemap skeleton

<?xml version="1.0" encoding="utf-8" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required