ASP.NET Syntax ASP.NET Syntax for Web Controls
Specifies a section on an output-cached Web page that is exempt from caching. At this location, dynamic content is retrieved and substituted for the Substitution control.
Declarative Syntax
<asp:Substitution
EnableTheming = "True | False"
EnableViewState = "True | False"
ID = "string"
MethodName = "string"
OnDataBinding = "DataBinding event handler"
OnDisposed = "Disposed event handler"
OnInit = "Init event handler"
OnLoad = "Load event handler"
OnPreRender = "PreRender event handler"
OnUnload = "Unload event handler"
runat = "server"
SkinID = "string"
Visible = "True | False"
/>
For information on the individual members of this class, see Substitution in the class library.
The Substitution control specifies a section for dynamic content on an output-cached Web Forms page.
The Substitution control offers a simplified solution to partial page caching for pages where the majority of the content is cached. You can output-cache the entire page, and then use Substitution controls to specify the parts of the page that are exempt from caching.
The following example demonstrates how to add a Substitution control declaratively to an output-cached Web page.
When the page loads, the current date and time are displayed to the user in a label. This section of the page is cached and updated every 120 seconds. When the Substitution control executes, it calls the getCurrentDateTime
method. The string returned by the getCurrentDateTime
is displayed to the user. Notice that this section of the page is not cached and is updated each time the page is refreshed.
<p>This section of the page is cached</p>
<asp:label id="cachedContent" runat="Server" />
<p>This section of the page is exempt from output caching</p>
<p id="msg"><asp:substitution id="subContent"
methodname = "getCurrentDateTime"
runat="Server" />
</p>
<p><asp:button id="RefreshButton"
text = "Refresh Page"
runat="Server" />
</p>
Show me
Substitution Class Substitution Web Server Control