Introduction
The
ASP.NET TreeView control is a powerful server-control for rendering
TreeView UI, as shown in the figure below. It supports a variety of
programming models, from statically-defined trees, to dynamically
constructed trees, to databound trees. The TreeView's rendering is fully
customizable, allowing for a wide-range of look-and-feels for the
control.
Example
<?xml version="1.0" encoding="utf-8"?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
<siteMapNode
url="~/default.aspx"
title="aspxCode"
description="aspxCode
Web site">
<siteMapNode
url="~/asp-net-standard-controls.aspx"
title="Standard
Controls"
description="Using
Standard Controls">
<siteMapNode
url="~/how-to-using-standard-asp-net.aspx?Controls=Label"
title="Label
Control"
description="Using
Label Control"/>
<siteMapNode
url="~/how-to-using-standard-asp-net.aspx?Controls=TextBox"
title="TextBox
Control"
description="Using
TextBox Control"/>
<siteMapNode
url="~/how-to-using-standard-asp-net.aspx?Controls=Button"
title="Button Control"
description="Using
Button Control"/>
</siteMapNode>
<siteMapNode
url="~/asp-net-data-controls.aspx"
title="Data
Controls"
description="Using
Data Controls">
<siteMapNode
url="~/how-to-using-data-asp-net.aspx?Controls=SqlDataSource"
title="SqlDataSource
Controls"
description="Using
SqlDataSource Controls"/>
<siteMapNode
url="~/Services/SecondService.aspx"
title="AccessDataSource
Controls"
description="Using
AccessDataSource Controls"/>
</siteMapNode>
</siteMapNode>
</siteMap>
|
<%@ Page="" Language="C#" AutoEventWireup="true" CodeFile="how-to-use-TreeView-c.aspx.cs" Inherits="how_to_use_TreeView_c" %>
<!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>How to Use TreeView</title>
</head>
<body>
<form id="form1" runat="server">
<div style="text-align: left">
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
<br />
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1">
</asp:TreeView>
</div>
</form>
</body>
</html>
|
0 comments :
Post a Comment