asp.net.ph

Skip Navigation Links

XmlDataSource Control Syntax

ASP.NET Syntax   ASP.NET Syntax for Web Controls


Represents an XML data source to data-bound controls.

Declarative Syntax

For information on the individual members of this class, see XmlDataSource in the class library.

Remarks

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.

Syntax Example

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>
See Also

XmlDataSource Class   XmlDataSource Web Server Control



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note