asp.net.ph

Skip Navigation Links

Substitution Control Syntax

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

For information on the individual members of this class, see Substitution in the class library.

Remarks

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.

Syntax Example

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 

See Also

Substitution Class   Substitution Web Server Control



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note