[ASP] Sitemap Sitemap

Source: Internet
Author: User

Introduction

Found in the project to use the site map of the control, did not summarize this aspect of things, wrote a demo test, here to record, is summed it.

Web.sitemap
1 <?XML version= "1.0" encoding= "Utf-8"?>2 <SiteMapxmlns= "http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >3   <SiteMapNodeURL= "default.aspx"title= "Home"Description="">4     <!--site map node, similar to a tree structure, the parent node includes child nodes, as follows -5     <SiteMapNodeURL=""title= "Organizational Structure"Description="">6       <SiteMapNodeURL= "Departmentmanager.aspx"title= "Department management"Description=""></SiteMapNode>7       <SiteMapNodeURL= "Usermanager.aspx"title= "User Management"Description=""></SiteMapNode>8     </SiteMapNode>9     <SiteMapNodeURL=""title= "Statistical information"Description="">Ten       <SiteMapNodeURL= "Vistorstatistics.aspx"title= "Access Statistics"Description=""></SiteMapNode> One       <SiteMapNodeURL= "Userinfostatistics.aspx"title= "User Statistics"Description=""></SiteMapNode> A     </SiteMapNode> -     <SiteMapNodeURL=""title= "System Parameters"Description=""> -       <SiteMapNodeURL= "Systemmanage.aspx"title= "System Settings"Description=""></SiteMapNode> the     </SiteMapNode> -   </SiteMapNode> - </SiteMap>
Master Page
1 <%@ Master Language="C #"AutoEventWireup="true"codebehind="Home.master.cs"Inherits="Wolfy.SiteMapDemo.Home" %>2 3 <!DOCTYPE HTML>4 5 <HTMLxmlns= "http://www.w3.org/1999/xhtml">6 <Headrunat= "Server">7     <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />8     <title></title>9     <Asp:contentplaceholderID= "Head"runat= "Server">Ten     </Asp:contentplaceholder> One </Head> A <Body> -     <formID= "Form1"runat= "Server"> -         <Div> the           -             <Asp:contentplaceholderID= "ContentPlaceHolder1"runat= "Server"> -             </Asp:contentplaceholder> -             <Asp:treeviewID= "TreeView1"runat= "Server"></Asp:treeview> +             <Asp:sitemappathID= "SiteMapPath1"runat= "Server"></Asp:sitemappath> -             +         </Div> A     </form> at </Body> - </HTML>

To bind a data source to a TreeView

New Data source

Generated HTML code:

1  <Asp:treeviewID= "TreeView1"runat= "Server"DataSourceID= "SiteMapDataSource1"></Asp:treeview>2             <Asp:sitemapdatasourceID= "SiteMapDataSource1"runat= "Server" />3             <Asp:sitemappathID= "SiteMapPath1"runat= "Server"></Asp:sitemappath>
Browse results

Summarize

Things are very simple, but also a knowledge point, record. Ning wrong kill 1000, don't let one!

Code: Link: http://pan.baidu.com/s/1jGsoYii Password: z88m

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.