How to: Customize Navigation

Most Web sites employ some form of customized user interface (UI) that provides users with visual clues on how to navigate in the site more easily, and find the information they need. Although the look and feel (or branding) can vary from site to site, the same basic navigation elements are usually present, such as navigation bars and menus that expose options a user can choose to navigate to a subsite or page.

This set of topics describes how Microsoft Office SharePoint Server 2007 navigation works and some ways you can customize it programmatically and through the UI, including:

  • Using the provider and data source APIs to customize the structure and behavior of vertical and horizontal menus.

  • Understanding Navigation Settings UI options and using them to set up a site navigation hierarchy.

  • Replacing the default navigation provider included in Office SharePoint Server 2007 with your own custom provider.

  • Configuring multiple navigation providers for a site.

Navigation Fundamentals

To make it easy to build effective navigation elements such as horizontal and vertical menus and breadcrumb navigation, Office SharePoint Server 2007 takes advantage of Microsoft ASP.NET 2.0 pluggable navigation—the Provider model. The Provider model defines a provider as a software module that provides a uniform interface between a service and a database. Providers abstract storage media in much the same way that device drivers abstract physical hardware devices, and you can use them to store state data virtually anywhere. For example, by developing custom providers, you can store state data in a variety of external data providers, such as front-end Web services, XML files, and databases. The navigation API includes a site map provider that abstracts site map data, and a data source object that maps and filters navigation structure and data from the provider for presentation in navigation UI Web controls. Both the provider and data source API include properties you can get and set that enable flexible, dynamic options for customizing your site.

Office SharePoint Server 2007 navigation is site-centric, meaning that each Web site in a site collection can determine the way the application displays each navigation item beneath it in the site hierarchy: all the way down to the next site. As a result, each site has several navigation options that you can set through the UI or programmatically.

You can create the navigation you want by determining in advance the hierarchy you want for the Web sites and pages you are creating, and by either fine-tuning the hierarchy by using the Navigation Settings page available through the Site Actions menu or Site Settings page in Office SharePoint Server 2007.

The default navigation system is based on the hierarchy for the site, and the navigation through the site occurs based on choices made through the UI or programmatically. Options you can set include whether to show subsites and pages in navigation, whether to sort navigation items manually or automatically, and how to handle individual sorting and display attributes and behavior of individual navigation items.

When you define vertical and horizontal menus, you can deploy a section of the navigation with one or more static or dynamic menu levels:

  • Static menu items represent levels of hierarchy and are usually hyperlinked. You can create additional levels of static and dynamic menu items under the top-level navigation item (the root).

  • Office SharePoint Server 2007 creates dynamic—fly-out—menu options based on site structure. The site hierarchy defines the levels in the navigation menu.

Your site can have any number of static and dynamic levels.

By design, navigation controls detect their location in a site structure, and use a complex method to determine the order in which to return nodes from the data store. When you sort navigation items, Office SharePoint Server 2007 first returns nodes from the data store and then sorts the navigation items.

See Also



Other Resources

How to: Work with Menus and Navigation Objects
How to: Modify Navigation Settings through the UI
How to: Customize Navigation Controls and Providers
Best Practices: Using Disposable Windows SharePoint Services Objects

Community Additions