Customizing the TreeView using Styles
<%@ Page Language="C#" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Customizing the TreeView using Styles</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SiteMapDataSource runat="Server" ID="SiteMapDataSource1" />
<asp:TreeView ID="Treeview1"
Runat="server"
DataSourceID="SiteMapDataSource1"
nodeindent="10"
font-names="Verdana"
font-size="8pt"
forecolor="Black">
<HoverNodeStyle BackColor="#CCCCCC"
BorderColor="#888888"
BorderStyle="Solid"
BorderWidth="1px"
Font-Underline="True">
</HoverNodeStyle>
<SelectedNodeStyle BackColor="White"
VerticalPadding="1"
BorderColor="#888888"
BorderStyle="Solid"
BorderWidth="1px"
HorizontalPadding="3">
</SelectedNodeStyle>
<NodeStyle VerticalPadding="2"
Font-Names="Verdana"
Font-Size="8pt"
NodeSpacing="1"
HorizontalPadding="5"
ForeColor="Black">
</NodeStyle>
</asp:TreeView>
</div>
</form>
</body>
</html>
File: 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="Home">
<siteMapNode url="~/Default.aspx" title="Books">
<siteMapNode url="~/Novels.aspx" title="Novels" />
<siteMapNode url="~/History.aspx" title="History" />
<siteMapNode url="~/Romance.aspx" title="Romance" />
</siteMapNode>
<siteMapNode url="~/Default.aspx" title="Electronics">
<siteMapNode url="~/Cameras.aspx" title="Camera" />
<siteMapNode url="~/Computers.aspx" title="Computer" />
</siteMapNode>
<siteMapNode url="~/Default.aspx" title="DVDs">
<siteMapNode url="~/Horror.aspx" title="Horror" />
<siteMapNode url="~/Kids.aspx" title="Kids" />
</siteMapNode>
<siteMapNode url="~/Default.aspx" title="Computers">
<siteMapNode url="~/Desktop.aspx" title="Desktop" />
<siteMapNode url="~/Laptop.aspx" title="Laptop" />
</siteMapNode>
</siteMapNode>
</siteMap>
Related examples in the same category