This tutorial shows you how to display data that resides in an XML file, in a GridView and DataList. VB version.

This tutorial shows how XML pages can be used to store data, and how you can use ASP.NET to display that data on your web page.

First, look at the XML file. You’ll notice it’s structure is hierarchical:

To display the data, we use a GridView control and XmlDataSource.

In this example, there is also a DataList which displays data nested in the XML file.

The following code makes sure the DataList displays the nested elements in the XML file, which are not shown in the GridView, when the user selects one of the entries in the GridView. This dynamically changes the Xpath when the user selects a new item from the GridView.

Download Source Files