Almost every site, in order to facilitate the user's page navigation in the website, you will not use the page navigation control. With the function of page navigation, users can easily perform jump between pages in a complex website. In the previous Web programming, you should write a good page navigation function, not that easy, but also use some tips. In ASP.NET 2.0, in order to facilitate the page navigation, add a page navigation control SiteMapDataSource, which can also be bound to different other page controls, such as TreeView, Menu, etc., very flexible, so that it is very convenient Implement different forms of page navigation, but also provide a programming interface, which can be programmed to dynamically implement page navigation controls. This article will briefly describe how to implement page navigation in ASP.NET 2.0 in ASP.NET 2.0. The structure of the page navigation and the SitemapDataSource control are in ASP.NET 2.0, to implement page navigation, you should first provide the page structure hierarchy of the entire website first in XML. We can write a XML text file called Web.SiteMap, define the structure hierarchy of the entire navigation page.
For example: Xml version = "1.0" encoding = "UTF-8"?>
After the SiteMap property is designed, you can build the page navigation function step by step, there are two steps: 1) Add a SiteMapDataSource control to the page. This control will automatically feel the contents of Web.siteMap. 2) Bind the SiteMapDataSource control into controls such as Sitemappath, TreeView, Menu, that is, set their data sources to the SiteMapDataSource control. After knowing the method, we will take TreeView, Menu, Sitemappath as an example, introduce how to use the SitemapDataSource control. First introduce how to use the TreeView control and SiteMapDataSource control. The TreeView tree list control is very suitable for page navigation. In order to specify, we make full use of the masterPage control in ASP.NET, first build a base framework architecture of a website.
In Visual Web Developer 2005 Beta 1, create a website, then add a web.sitemap file on the article, add a page called Navigation master type, the code is as follows: <% @ Master language = "c #"%> < HTML XMLns = "http://www.w3.org/1999/xhtml">