aps.net 4.5 练习~test12-5 treeview新闻

258 篇文章 2 订阅

web.sitemap

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode  url="~/WebForm1.aspx" title="首页"  description="Home">

    <siteMapNode  url="~/News.aspx" title="新闻"  description="News" >
      <siteMapNode url="~/NewsFocus.aspx" title="焦点新闻" description=""/>
      <siteMapNode url="~/NewsInside.aspx" title="国内新闻" description=""/>
      <siteMapNode url="~/NewsOutside.aspx" title="国际新闻" description=""/>
    </siteMapNode>

    <siteMapNode  url="~/Finance.aspx" title="财经"  description="Finance" >
      <siteMapNode  url="~/Stock.aspx" title="股票"  description=""  />
      <siteMapNode  url="~/Money.aspx" title="理财"  description="" />
      <siteMapNode url="~/Exchange.aspx" title="外汇" description=""/>
      <siteMapNode url="~/Fund.aspx" title="基金" description=""/>
    </siteMapNode>

    <siteMapNode  url="~/Internet.aspx" title="互联网"  description="Internet" >
      <siteMapNode  url="~/baidu.aspx" title="百度"  description="" />
      <siteMapNode  url="~/wangyi.aspx" title="网易"  description="" />
    </siteMapNode>
  </siteMapNode>
</siteMap>

webform1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="test12_5.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" ImageSet="News" NodeIndent="10">
            <HoverNodeStyle Font-Underline="True" />
            <NodeStyle Font-Names="Arial" Font-Size="10pt" ForeColor="Black" HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="0px" />
            <ParentNodeStyle Font-Bold="False" />
            <SelectedNodeStyle Font-Underline="True" HorizontalPadding="0px" VerticalPadding="0px" />
        </asp:TreeView>
        <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
    </div>
    </form>
</body>
</html>

web.config

<?xml version="1.0" encoding="utf-8"?>

<!--
  有关如何配置 ASP.NET 应用程序的详细信息,请访问
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
    <system.web>
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
      <siteMap defaultProvider="XmlSiteMapProvider1" enabled="true" >
        <providers>
          <clear/>
          <add name="XmlSiteMapProvider1" type="System.Web.XmlSiteMapProvider" siteMapFile="Web.sitemap"/>
        </providers>
      </siteMap>
    </system.web>

</configuration>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

虾米大王

有你的支持,我会更有动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值