asp:BoundField Demo
<%-- Code Revised from Professional ASP.NET 2.0 XML (Programmer to Programmer) (Paperback) by Thiru Thangarathinam # Publisher: Wrox (January 18, 2006) # Language: English # ISBN: 0764596772 --%> <%@ Page Language="C#" %> <%@ OutputCache Duration="6000" VaryByParam="none" %> <%@ Import Namespace="System.Xml" %> <script runat="server"> void Page_Load(object sender, EventArgs e) { lblCurrentTime.Text = "Current Time is : " + DateTime.Now.ToLongTimeString(); } </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Caching XML Data in an XmlDataSource Control</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Label Runat="server" ID="lblCurrentTime"></asp:Label> </div> <div> <asp:GridView ID="GridView1" Runat="server" DataSourceID="XmlDataSource1" AutoGenerateColumns="False"> <Columns> <asp:BoundField HeaderText="ISBN" DataField="ISBN" SortExpression="ISBN"></asp:BoundField> <asp:BoundField HeaderText="Title" DataField="Title" SortExpression="Title"></asp:BoundField> <asp:BoundField HeaderText="Price" DataField="Price" SortExpression="Price"></asp:BoundField> </Columns> </asp:GridView> <asp:XmlDataSource ID="XmlDataSource1" Runat="server" DataFile="Bookstore.xml" XPath="bookstore/genre[@name='Fiction']/book"> </asp:XmlDataSource> </div> </form> </body> </html> <%-- <bookstore> <genre name="Fiction"> <book ISBN="10-861003-324" Title="title 1" Price="19.99"> <chapter num="1" name="Introduction"> A </chapter> <chapter num="2" name="Body"> B </chapter> <chapter num="3" name="Conclusion"> C </chapter> </book> <book ISBN="1-861001-57-5" Title="title " Price="24.95"> <chapter num="1" name="Introduction"> D </chapter> <chapter num="2" name="Body"> E </chapter> <chapter num="3" name="Conclusion"> F </chapter> </book> </genre> <genre name="NonFiction"> <book ISBN="10-861003-324" Title="title 2" Price="19.99"> <chapter num="1" name="Introduction"> G </chapter> <chapter num="2" name="Body"> H </chapter> <chapter num="3" name="Conclusion"> I </chapter> </book> <book ISBN="1-861001-57-6" Title="title 3" Price="27.95"> <chapter num="1" name="Introduction"> J </chapter> <chapter num="2" name="Body"> K </chapter> <chapter num="3" name="Conclusion"> L </chapter> </book> </genre> </bookstore> --%>