Binding to XML Files

Although an in-depth analysis of XML and its place in the .NET Framework is beyond the scope of this chapter, you do need to know how to use an XML file as a data source for server controls, and the DataGrid in particular. Chapter 12, “XML and SOAP,” will explore what XML is and its role in the .NET Framework. This section will only show you how to open and read an existing XML file and bind the data to a DataGrid.

An XML file is nothing more than a text file that's been marked up according to the XML standard, much like an HTML file is simply marked-up text. Since you cannot connect to a text file the way you connect to a database, you don't use the ADO.NET Managed Providers to access the XML file. Instead, you must open ...

Get Programming Data-Driven Web Applications with ASP.NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.