Sharing a User Control Output Cache : User Control « Cache « ASP.NET Tutorial






File: Control.ascx

<%@ Control Language="C#" ClassName="SharedProducts"%> 
<%@ OutputCache Duration="600" VaryByParam="none" Shared="true" %>

User Control Time:
<%= DateTime.Now.ToString() %>

<asp:GridView
    id="grdProducts"
    DataSourceID="srcProducts"
    Runat="server" />

<asp:SqlDataSource
    id="srcProducts"
    ConnectionString="<%$ ConnectionStrings:Products %>"
    SelectCommand="SELECT Title,Director FROM Products"
    Runat="server" />








13.15.User Control
13.15.1.Caching with a User Control
13.15.2.Sharing a User Control Output Cache
13.15.3.Creating a User Control Cache File Dependency
13.15.4.Programmatically caching a User Control.