Binding to an XML File

Because an XmlDataSource control returns hierarchical data, you can bind a TreeView directly to an XmlDataSource. For example, imagine that you need to display the XML document contained in Listing 22.22.

Listing 22.22. Movies.xml

images

The page in Listing 22.23 illustrates how you can display the contents of this XML document with a TreeView control.

Listing 22.23. TreeViewXml.aspx

images

The Movies.xml document in Listing 22.22 is extremely simple. The elements do not include any attributes. You can display more complicated XML documents ...

Get ASP.NET 4 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.