webform1.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TreeView.T1.WebForm1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html > <head id="Head1" runat="server"> <title>ASP.NET Example</title> </head> <body> <form id="form1" runat="server"> <asp:xmldatasource id="XmlDataSource1" runat="server" datafile="books.xml" /> <!- TreeView uses hierachical data, so the XmlDataSource uses an XmlHierarchicalDataSourceView when a TreeView is bound to it. --> <asp:TreeView id="TreeView1" runat="server" datasourceid="XmlDataSource1"> <databindings> <asp:treenodebinding datamember="book" textfield="title"/> </databindings> </asp:TreeView> <asp:XmlDataSource ID="XmlDataSource2" runat="server" ></asp:XmlDataSource> </form> </body> </html> book.xml <?xml version="1.0" encoding="utf-8" ?> <books> <computerbooks> <book title="Secrets of Silicon Valley" author="Sheryl Hunter"/> <book title="Straight Talk About Computers" author="Dean Straight"/> <book title="You Can Combat Computer Stress!" author="Marjorie Green"/> </computerbooks> <cookbooks> <book title="Silicon Valley Gastronomic Treats" author="Innes del Castill"/> </cookbooks> </books>