Caching XML Data in an XmlDataSource Control : XmlDataSource « XML « ASP.Net

ASP.Net
1. ADO.net Database
2. Ajax
3. Asp Control
4. Collections
5. Components
6. Data Binding
7. Development
8. File Directory
9. HTML Control
10. Language Basics
11. Login Security
12. Mobile Control
13. Network
14. Page
15. Request
16. Response
17. Server
18. Session Cookie
19. Sitemap
20. Theme Style
21. User Control and Master Page
22. Validation by Control
23. Validation by Function
24. WebPart
25. WPF
26. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
ASP.Net » XML » XmlDataSource 
Caching XML Data in an XmlDataSource Control

       
<%--
Code Revised from
       
Professional ASP.NET 2.0 XML (Programmer to Programmer) (Paperback)
by Thiru Thangarathinam 

# Publisher: Wrox (January 182006)
# Language: English
# ISBN: 0764596772
--%>         
       
<%@ Page Language="C#" %>
<%@ 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>           
        <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 EnableCaching="true" CacheDuration="100" CacheExpirationPolicy="Absolute"
        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>
--%>


           
       
Related examples in the same category
1. asp:Xml datasource
2. Create asp XmlDataSource
3. Binding XML Data from an XmlDataSource Control
4. Using Inline XML Data in an XmlDataSource Control
5. Binding XML Data from Other Sources
6. Updating Data through XmlDataSource Control
7. Programmatically Creating an XmlDataSource Control
8. Handling XmlDataSource Events
9. Fill XmlDataSource with your code
10. XmlDataSource and XML document
11. Use ItemTemplate and XPath to display data from XmlDataSource
12. Using the XmlDataSource control to consume an RSS feed
13. Enter an XML filename or raw XML starting with
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.