ASP.NET Syntax ASP.NET Syntax for Web Controls
Represents an XML data source to data-bound controls.
Declarative Syntax
<asp:XmlDataSource
CacheDuration = "string | Infinite"
CacheExpirationPolicy = "Absolute | Sliding"
CacheKeyDependency = "string"
DataFile = "string"
EnableCaching = "True | False"
EnableTheming = "True | False"
EnableViewState = "True | False"
ID = "string"
OnDataBinding = "DataBinding event handler"
OnDisposed = "Disposed event handler"
OnInit = "Init event handler"
OnLoad = "Load event handler"
OnPreRender = "PreRender event handler"
OnTransforming = "Transforming event handler"
OnUnload = "Unload event handler"
runat = "server"
SkinID = "string"
TransformArgumentList = "string"
TransformFile = "string"
Visible = "True | False"
XPath = "string"
>
<Data>string</Data>
<Transform>string</Transform>
</asp:XmlDataSource>
For information on the individual members of this class, see XmlDataSource in the class library.
The XmlDataSource control is a data source control that represents XML data to data-bound controls.
Because the XmlDataSource control extends the HierarchicalDataSourceControl class, and implements the IDataSource interface as well, the control can be used by data-bound controls to display both hierarchical and tabular, or list-style, data.
The XmlDataSource control is typically used to display data in read-only scenarios.
The following example demonstrates how to bind a TreeView control to an XmlDataSource control with XML data that is defined using the Data property.
<asp:treeview id="booktreeview" datasourceid="books" runat="server">
<databindings>
<asp:treenodebinding datamember = "book" textfield = "title" />
<asp:treenodebinding datamember = "chapter" textfield = "heading" />
<asp:treenodebinding datamember = "section" textfield = "heading" />
</databindings>
</asp:treeview>
<asp:xmldatasource id="books" runat="server">
<data>
<book title = "book title">
<chapter heading = "Chapter 1">
<section heading = "Section 1" />
<section heading = "Section 2" />
</chapter>
<chapter heading = "Chapter 2">
<section heading = "Section 1" />
</chapter>
</book>
</data>
</asp:xmldatasource>
XmlDataSource Class XmlDataSource Web Server Control