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 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.