TAILIEUCHUNG - ASP.NET 4 Unleased - p 112

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 file in Listing . 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 xml version encoding utf-8 siteMap xmlns http AspNet siteMapNode url title Home description The Home Page siteMapNode url Products title Our Products description Products that we offer siteMapNode url Products title First Product description The description of the First Product siteMapNode url Products title Second Product description The description of the Second Product siteMapNode siteMapNode url Services title Our Services description Services that we offer siteMapNode url Services 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 title Second Service description The description of the Second Service siteMapNode siteMapNode siteMap The Site Map file in Listing represents a website with the following folder and page structure Products Services The page in Listing illustrates how you can represent a Site Map by binding a TreeView control to the