Mega Code Archive

 
Categories / ASP.Net / XML
 

Using Inline XML Data in an XmlDataSource Control

<%@ Page Language="C#" %> <html xmlns="http://www.w3.org/1999/xhtml" > <head>     <title>Using Inline XML Data in an XmlDataSource Control</title> </head> <body>         <form id="form1" runat="server">     <div>         <asp:TreeView ID="bookView" Runat="server" DataSourceID="bookSource">             <DataBindings>                 <asp:TreeNodeBinding ImageUrl="~/Images/openbook.gif" TextField="Title" DataMember="book"></asp:TreeNodeBinding>                 <asp:TreeNodeBinding ImageUrl="~/Images/notepad.gif" TextField="name" DataMember="chapter"></asp:TreeNodeBinding>             </DataBindings>         </asp:TreeView>         </div>         <div>             <asp:XmlDataSource ID="bookSource" Runat="server" XPath="Data/book">                                   <Data>   <genre name="Fiction">     <book ISBN="1" Title="title 1" Price="19.99" Discount="1.999">       <chapter num="1" name="Introduction">         Abstract...       </chapter>       <chapter num="2" name="Body">         Abstract...       </chapter>       <chapter num="3" name="Conclusion">         Abstract...       </chapter>     </book>   </genre>                 </Data>             </asp:XmlDataSource>         </div>     </form> </html>