In almost every web site, the use of page navigation controls is indispensable in order to facilitate page navigation in the site. With the function of page navigation, users can easily jump between pages in a complex website. In the previous web programming, to write a good page navigation function, is not so easy, but also to use some skills. In ASP.net 2.0, in order to facilitate page navigation, a new called page navigation control SiteMapDataSource, which can also be bound to different other page controls, such as Treeview,menu, very flexible, So that the different forms of page navigation can be easily implemented, but also provides a run-time programming interface, can be programmed to dynamically implement the page navigation control. This article will simply take a few examples to illustrate how to implement page navigation in ASP.net 2.0.
Structure and SiteMapDataSource controls for page navigation
In ASP.net 2.0, to implement page navigation, you should first provide the page structure level of the entire website in the form of XML. We can write an XML text file called Web.sitemap that defines the hierarchy of the entire navigation page. Examples are as follows:
<?xml version= "1.0" encoding= "Utf-8"?
<siteMap>
<sitemapnode title= "Default" description= "Home" url= "default.aspx"
<sitemapnode title= "Members", description= "members" url= "Members.aspx"
<sitemapnode title= "My Account" description= "I Account" url= "myaccount.aspx"/>
<sitemapnode title= "Products" description= "Products" url= "products.aspx"
</siteMapNode>
<sitemapnode title= "Administration" description= "Administration" url= "~/admin/default.aspx"
<sitemapnode title= "Customer" description= "Customer Admin" url= "~/admin/customer/default.aspx"/>
<sitemapnode title= "Products admin" description= "Products admin" url= "~/admin/productsadmin.aspx"/>
</siteMapNode>
</siteMapNode>
</siteMap>
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