Đang chuẩn bị liên kết để tải về tài liệu:
ASP.NET 4 Unleased - p 112
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Sử dụng Control SiteMapDataSource Việc kiểm soát SiteMapDataSource cho phép bạn đại diện cho một đồ trang web khai báo trong một trang. Bạn có thể liên kết điều hướng như TreeView và Menu điều khiển để điều khiển SiteMapDataSource. | 1084 CHAPTER 23 Using Site Maps Using the SiteMapDataSource Control The SiteMapDataSource control enables you to represent a Site Map declaratively in a page. You can bind navigation controls such as the TreeView and Menu controls to a SiteMapDataSource control. You also can bind other controls such as the GridView or DropDownList control to a SiteMapDataSource control. Imagine for example that your website contains the Web.sitemap file in Listing 23.1. Because the default SiteMapProvider is the XmlSiteMapProvider the SiteMapDataSource control automatically represents the contents of this XML file. NOTE The code samples in this section are located in the SiteMaps application on the website for this book. LISTING 23.1 Web.sitemap xml version 1.0 encoding utf-8 siteMap xmlns http schemas.microsoft.com AspNet SiteMap-File-1.0 siteMapNode url Default.aspx title Home description The Home Page siteMapNode url Products Default.aspx title Our Products description Products that we offer siteMapNode url Products FirstProduct.aspx title First Product description The description of the First Product siteMapNode url Products SecondProduct.aspx title Second Product description The description of the Second Product siteMapNode siteMapNode url Services Default.aspx title Our Services description Services that we offer siteMapNode url Services FirstService.aspx title First Service description The description of the First Service From the Library of Wow eBook Using the SiteMapDataSource Control 1085 metaDescription The first service siteMapNode url Services SecondService.aspx title Second Service description The description of the Second Service siteMapNode siteMapNode siteMap The Site Map file in Listing 23.1 represents a website with the following folder and page structure Default.aspx Products FirstProduct.aspx SecondProduct.aspx Services FirstService.aspx SecondService.aspx The page in Listing 23.2 illustrates how you can represent a Site Map by binding a TreeView control to the