The XmlDataSource control makes XML data available to data-bound controls. You can use it to display both hierarchical and tabular data, although the XmlDataSource control is typically used to display hierarchical XML data in read-only scenarios.

The most common way to use an XmlDataSource is to specify it in the Data Source Configuration Wizard when you set the Data Source of a data-bound control such as the GridView, FormView, DetailsView, DataList, or Repeater.

You can also add an XmlDataSource control to a page by dragging it from the Toolbox panel onto your page. When the control is on your page, right-click it and choose Properties to open the Tag Properties panel where you can set properties for the control.

tip noteTip

Many ASP.NET controls do not have a visual representation at run time. The control is always visible in Code view. If you do not see a representation of the control in Design view, on the View menu, point to Visual Aids and then click ASP.NET Non Visual Controls.

The XmlDataSource control loads XML data from an XML file specified using the DataFile property. XML data can also be loaded from a string using the Data property.

For more information about using the XmlDataSource control, see XmlDataSource Web Server Control (Visual Studio) Cc295437.xtlink_newWindow(en-us,Expression.40).png in the MSDN library.

See also

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.

Community Additions