Tree style with XML data : TreeView « ASP.net Controls « ASP.NET Tutorial

ASP.NET Tutorial
1. ASP.Net Instroduction
2. Language Basics
3. ASP.net Controls
4. HTML Controls
5. Page Lifecycle
6. Response
7. Collections
8. Validation
9. Development
10. File Directory
11. Sessions
12. Cookie
13. Cache
14. Custom Controls
15. Profile
16. Configuration
17. LINQ
18. ADO.net Database
19. Data Binding
20. Ajax
21. Authentication Authorization
22. I18N
23. Mobile
24. WebPart
25. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
ASP.NET Tutorial » ASP.net Controls » TreeView 
3. 27. 8. Tree style with XML data
<%@ page language="VB" %>

<script runat="server">

</script>

<html>
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form runat="server">
        <asp:treeview id="TreeView1" 
                      runat="server" 
                      font-underline="False" 
                      datasourceid="XmlDataSource1"
                      font-names="Tahoma" 
                      font-size="8pt" 
                      font-italic="False" 
                      font-bold="False" 
                      imageset="XP_Explorer"
                      forecolor="Black" 
                      nodeindent="15" 
                      autogeneratebindings="False">
            <selectednodestyle backcolor="#B5B5B5" 
                               font-underline="False" 
                               font-italic="False"
                               font-bold="False">
            </selectednodestyle>
            <hovernodestyle forecolor="#6666AA" 
                            font-underline="True" 
                            font-italic="False" 
                            font-bold="False">
            </hovernodestyle>
            <bindings>
                <asp:treenodebinding value="My Bookstore" depth="0" text="My Bookstore">
                </asp:treenodebinding>
                <asp:treenodebinding datamember="genre" textfield="name" depth="1">
                </asp:treenodebinding>
                <asp:treenodebinding datamember="book" textfield="isbn" depth="2">
                </asp:treenodebinding>
            </bindings>
            <parentnodestyle font-underline="False" font-italic="False" font-bold="False">
            </parentnodestyle>
            <leafnodestyle font-underline="False" font-italic="False" font-bold="False">
            </leafnodestyle>
            <nodestyle forecolor="Black" 
                       verticalpadding="2" 
                       horizontalpadding="2" 
                       font-underline="False"
                       font-names="Tahoma" 
                       font-size="8pt" 
                       font-italic="False" 
                       font-bold="False">
            </nodestyle>
            <rootnodestyle font-underline="False" font-italic="False" font-bold="False">
            </rootnodestyle>
        </asp:treeview>
        <asp:xmldatasource id="XmlDataSource1" runat="server" datafile="Data.xml">
        </asp:xmldatasource>

    </form>
</body>
</html>

File: Data.xml

<?xml version="1.0" standalone="yes"?>
<bookstore>
  <genre name="fiction">
    <book ISBN="10-000000-001">
      <title>title 1</title>
      <price>12.95</price>
      <comments>
        <userComment rating="4">
           comment 1
        </userComment>
        <userComment rating="2">
           comment 2
        </userComment>
      </comments>
    </book>
  </genre>
</bookstore>
3. 27. TreeView
3. 27. 1. Using the TreeView Control
3. 27. 2. Selecting a TreeView node.
3. 27. 3. Displaying TreeView check boxes.
3. 27. 4. Displaying a Site Map with a TreeView control.
3. 27. 5. Binding to an XML File
3. 27. 6. Complex tree view
3. 27. 7. Tree view style
3. 27. 8. Tree style with XML data
3. 27. 9. Tree view event
w___w__w_.___ja_v_a2_s_._com___ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.