1、首先建立一个Default.aspx的主页面,再建立一个站点地图:Web.sitemap
2、Default.aspx的主页面的设计
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="TreeView控件1._default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1"
ImageSet="WindowsHelp">
<HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
<NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black"
HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="1px" />
<ParentNodeStyle Font-Bold="False" />
<SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False"
HorizontalPadding="0px" VerticalPadding="0px" />
</asp:TreeView>
<br />
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</div>
</form>
</body>
</html>
3、站点地图: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="首页" description="">
<siteMapNode url="1ASPDotNet.aspx" title="Net方向" description="" >
<siteMapNode url="NetTerm1.aspx" title="Net方向第一学期" description="" >
<siteMapNode url="NetTerm1C1.aspx" title="第一学期课程1htmlcss与js" description="" />
<siteMapNode url="NetTerm1Course2.aspx" title="第一学期课程2C#" description="" />
</siteMapNode>
<siteMapNode url="NetTerm2.aspx" title="Net方向第二学期" description="" />
</siteMapNode>
<siteMapNode url="2java.aspx" title="Java方向" description="" >
<siteMapNode url="javaTerm1.aspx" title="java方向第一学期" description="" />
<siteMapNode url="JavaTerm2.aspx" title="java方向第二学期" description="" />
</siteMapNode>
<siteMapNode url="3php.aspx" title="Php方向" description="" />
</siteMapNode>
</siteMap>
4、建立站点地图里面的相关的叶子如1ASPDotNet.aspx、NetTerm1.aspx等叶子,把站点地图里面的叶子都要建立出来
5、再把主页Default.aspx里面的内容可以粘贴到个个子叶上
6、主页效果图如下: