Establish site navigation hierarchy in asp.net 2.0 (1)

Source: Internet
Author: User
Tags define contains interface net access

The site navigation provider in the site navigation provider--asp.net 2.0 exposes navigation information for pages in the application, allowing you to define the structure of the site individually, regardless of the actual physical layout of the page. The default site navigation provider is xml-based, but you can also expose the information from any back-end location by writing a custom provider.

The site navigation api--site Navigation API is used to access site navigation information in the application's code, which extracts the details of the navigation information store. You can use APIs to programmatically access the application's navigation nodes.

Navigation controls-navigation controls provide a common UI for navigating between pages, such as tree views, menus, and breadcrumb ("breadcrumbs", a control that displays the current page). These controls use the site navigation service in ASP.net 2.0 to retrieve the structure you have defined for your site. The SiteMapDataSource control also allows you to bind other UI controls to site navigation data.

Web sites often need to display navigation data to guide users on how to use the site. Asp. NET allows developers to simply define navigation data and to display the UI based on that information.

The site Navigation API is a provider-based (provider) programming content that is used to access site navigation data. The API stores navigation data in an XML file and exposes the data through a set of SiteMapNode classes. Application and control developers can build SiteMapNode instances and use this information to display the navigation interface.

Navigation-oriented server controls include menu, TreeView, SiteMapPath, and SiteMapDataSource controls. These controls are built at the top of the site navigation class, and they use and display navigation data regardless of the specific details of the data store. The menu and TreeView controls can also use data from XML files and XmlDataSource controls.

The URL mapping attribute allows developers to define simple rules for the remapping (re-mapping) of different URL requests.

Using Site navigation controls

The Menu, TreeView, SiteMapPath, and SiteMapDataSource controls generate navigation interfaces based on navigation data. Navigation data can be stored in an XML file, or by leveraging the capabilities of the site navigation feature based on the provider. The following example shows how to combine different controls that use site navigation features.

Building an application Site map

The example navigation structure is stored in the Web.sitemap file, where you can see the sitemap file. The Web.sitemap file contains a top-level element. Nesting at least one element within an element. There must be a top-level in a site map. The site navigation feature requires a root to ensure that access along the node hierarchy eventually converges to a known node. You can nest multiple elements under the root element. In addition, the depth of the nested elements is unrestricted.

An element usually contains a URL (link), title (title), and description (description) attribute. The URL property indicates the path that corresponds to the page in the application. It can also contain the path to a page in another application, or to multiple URLs for a completely different Web site. In the following example, all URL properties use the application-relative syntax to refer to the path. The Title property is used to display the text content of the navigation data UI. For example, the SiteMapPath control displays the title property as the hyperlink text for the control. If the Description property is provided, the server control displays as a ToolTip or alt text. Developers can also add custom attributes, using the SiteMapNode class's default indexer (indexer) to retrieve these properties. You can check it out. NET Framework component documentation to find more information about some of the other attributes of the element.

The content of Web.sitemap

The following is a reference fragment:






......


Using Site navigation controls

The easiest way to provide site navigation on a Web page is to use a graphical site navigation control (SiteMapPath, TreeView, and Menu).

· sitemappath--a breadcrumb control that retrieves the user's current page and displays the hierarchical structure of the page. This allows the user to navigate back to other pages in the hierarchy. SiteMapPath can only be used with SiteMapProvider, you need to set the control's SiteMapProvider property.

· treeview--provides a vertical user interface on a Web page that expands and shrinks selected nodes, or provides check box functionality for users to select data items. The TreeView control supports declarative or programmatic settings for data elements and data source controls. If you use the SiteMapDataSource control, data binding is done automatically.

· menu--provides a horizontal or vertical user interface that pops up when the user puts the mouse over an item. The menu control supports declarative or programmatic settings for data elements or data source controls. If you use the SiteMapDataSource control, data binding is done automatically.

Note that both the TreeView and the menu controls can be used in situations that are not navigable.

The following table describes the differences between the TreeView and the menu so that you can make the appropriate choices as needed.

Attributes Menu TreeView

Extended Pop-up location extension

Download No Yes on Demand

check box No Yes

Template Yes No

Layout Horizontal & Vertical Vertical

The style option Yes Yes

Select the mode static, dynamic hierarchy or parent/root/leaf, or by data item



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.