Partilhar via


How to: Customize Navigation in SharePoint Server 2010 (ECM)

Applies to: SharePoint Server 2010

Most Web sites use some form of customized user interface (UI) that provides users with visual clues about how to navigate the site more easily, and find the information they want. 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 that a user can choose to navigate to a subsite or page.

This set of topics describes how Microsoft SharePoint Server 2010 navigation works and some ways that 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 SharePoint Server 2010 with your own custom provider.

  • Configuring multiple navigation providers for a site.

To make it easier to build effective navigation elements, such as horizontal and vertical menus and breadcrumb navigation, SharePoint Server 2010 takes advantage of ASP.NET 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 almost 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 SharePoint Server 2010 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 that you can get and set that enable flexible, dynamic options for customizing your site.

SharePoint Server 2010 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 that you want by determining in advance the hierarchy that you want for the Web sites and pages you are creating. You can either fine-tune the hierarchy by using the Navigation Settings page available through the Site Actions menu or you can use the Site Settings page in SharePoint Server 2010.

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 that 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).

  • SharePoint Server 2010 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, SharePoint Server 2010 first returns nodes from the data store and then sorts the navigation items.

See Also

Reference

Microsoft.SharePoint.Publishing.Navigation

Microsoft.SharePoint.Navigation

Other Resources

How to: Work with Menus and Navigation Objects

How to: Customize Navigation Controls and Providers

Best Practices: Using Disposable Windows SharePoint Services Objects