ASP.NET 3.5 and above only

ASP.NET TreeView - Binding With XmlDataSource

  • Book Title 1
    • Chapter 1
      • Section 1
      • Section 2
    • Chapter 2
      • Section 1
  • Book Title 2
    • Chapter 1
      • Section 1
      • Section 2
    • Chapter 2
      • Section 1
[ASPX]

            <obout:Tree ID="ObClassicTree" CssClass="vista" DataSourceID="XmlDataSource1"
                runat="server">
                <DataBindings>
                    <obout:NodeBinding 
                        DataMember="Book" 
                        ImageUrl="~/obout.ajax.ui/treeview/examples/img/vista_book.png" 
                        TextField="Title"
                        Expanded="true" />
                    <obout:NodeBinding 
                        DataMember="Chapter" 
                        ImageUrl="~/obout.ajax.ui/treeview/examples/img/vista_note.png"
                        TextField="Heading" />
                    <obout:NodeBinding 
                        DataMember="Section" 
                        ImageUrl="~/obout.ajax.ui/treeview/examples/img/vista_note.png"
                        TextField="Heading" />
                </DataBindings>
            </obout:Tree>
            <asp:XmlDataSource ID="XmlDataSource1" DataFile="~/obout.ajax.ui/treeview/examples/books.xml"
                    XPath="Books/Book" runat="server">
            </asp:XmlDataSource>
            
[books.xml]

            <?xml version="1.0" encoding="utf-8" ?>
            <Books>
              <Book Title="Book Title 1">
                <Chapter Heading="Chapter 1">
                  <Section Heading="Section 1">
                  </Section>
                  <Section Heading="Section 2">
                  </Section>
                </Chapter>
                <Chapter Heading="Chapter 2">
                  <Section Heading="Section 1">
                  </Section>
                </Chapter>
              </Book>
              <Book Title="Book Title 2">
                <Chapter Heading="Chapter 1">
                  <Section Heading="Section 1">
                  </Section>
                  <Section Heading="Section 2">
                  </Section>
                </Chapter>
                <Chapter Heading="Chapter 2">
                  <Section Heading="Section 1">
                  </Section>
                </Chapter>
              </Book>
            </Books>
            

"First of all... loved the controls... its wonderful features and ease of use. Most of all, I would like to commend your support group. Even if we're still in evaluation mode, the support team has been great and very response. Keep up the great work!"

James Gagni Jr.
Aon Singapore

Random testimonial   All testimonials