zoukankan      html  css  js  c++  java
  • [Asp.net]站点地图SiteMap

    引言

    在项目中发现使用站点地图的控件,之前没总结过这方面的东西,就写了一个demo测试了一下,这里记录一下,算是总结吧。

    Web.sitemap

     1 <?xml version="1.0" encoding="utf-8" ?>
     2 <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
     3   <siteMapNode url="Default.aspx" title="首页"  description="">
     4     <!--站点地图节点,类似树形结构,父节点包括子节点,如下-->
     5     <siteMapNode url="" title="组织结构"  description="">
     6       <siteMapNode url="DepartmentManager.aspx" title="部门管理"  description=""></siteMapNode>
     7       <siteMapNode url="UserManager.aspx" title="用户管理"  description=""></siteMapNode>
     8     </siteMapNode>
     9     <siteMapNode url="" title="统计信息"  description="">
    10       <siteMapNode url="VistorStatistics.aspx" title="访问统计"  description=""></siteMapNode>
    11       <siteMapNode url="UserInfoStatistics.aspx" title="用户统计"  description=""></siteMapNode>
    12     </siteMapNode>
    13     <siteMapNode url="" title="系统参数"  description="">
    14       <siteMapNode url="SystemManage.aspx" title="系统设置"  description=""></siteMapNode>
    15     </siteMapNode>
    16   </siteMapNode>
    17 </siteMap>

    母版页

     1 <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Home.master.cs" Inherits="Wolfy.SiteMapDemo.Home" %>
     2 
     3 <!DOCTYPE html>
     4 
     5 <html xmlns="http://www.w3.org/1999/xhtml">
     6 <head runat="server">
     7     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     8     <title></title>
     9     <asp:ContentPlaceHolder ID="head" runat="server">
    10     </asp:ContentPlaceHolder>
    11 </head>
    12 <body>
    13     <form id="form1" runat="server">
    14         <div>
    15          
    16             <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
    17             </asp:ContentPlaceHolder>
    18             <asp:TreeView ID="TreeView1" runat="server"></asp:TreeView>
    19             <asp:SiteMapPath ID="SiteMapPath1" runat="server"></asp:SiteMapPath>
    20            
    21         </div>
    22     </form>
    23 </body>
    24 </html>

    为treeview绑定数据源

    新建数据源

     生成的html代码:

    1  <asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1"></asp:TreeView>
    2             <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
    3             <asp:SiteMapPath ID="SiteMapPath1" runat="server"></asp:SiteMapPath>

    浏览结果

    总结

    东西非常简单,也算是个知识点把,记录一下。宁错杀一千,不放过一个!

    代码:链接:http://pan.baidu.com/s/1jGsoYii 密码:z88m

  • 相关阅读:
    Spring(001)-Hello Spring
    actuator beans不展示
    Java读取property文件
    PostgreSQL 后端存储
    python 中global() 函数
    python项目配置文件格式
    大数据时代,数据成了研究的基石
    10w数据重建索引报错:java.lang.IllegalStateException: Batch statement cannot contain more than 65535 statements
    java学习day15--API-ArrayList--LinkedList
    java学习day14--API-集合(Collection)+List
  • 原文地址:https://www.cnblogs.com/wolf-sun/p/3782654.html
Copyright © 2011-2022 走看看