Go to DotNetFunda.com
 Online : 3122 |  Welcome, Guest!   Login
 
<<= Please see left side tutorials menu.

  • Download the OOPS, ASP.NET and ADO.NET Training Videos for FREE, click here.


Silverlight Tutorials | Report a Bug in the Tutorial

Interesting?   Share and Bookmark this

asp:Substitution control
Substitution control is used to call a method that returns a string in an output-cached page.
 
Ideally Substitution control is used to call a method that returns a string in an output-cached page. Generally it is used when you want to cache a page but still want to return a dynamic string at a paricular part of the page.

There is one property that is used to return the dynamic string
MethodName Used to assign method name that will fire each time page will load and return the string. Please note that this method will be a static method.
DEMO : Substitution Show Source Code
DateTime using Substitution: 3/15/2010 1:45:55 PM DateTime using Cachced: 3/15/2010 1:45:55 PM

Notice that Cahced datetime will not change while Substituted datetime will change after each page refresh.
// Substitution Control /////////////////////////////////////////
<asp:Substitution ID="Substitution1" runat="server" MethodName="WriteCurrentTimeDespiteThePageIsCahced" />

 // Code Behind /////////////////////////////////////////
 protected static string WriteCurrentTimeDespiteThePageIsCahced(HttpContext context)
    {
        return DateTime.Now.ToString();
    }                    




About Us | The Team | Advertise | Contact Us | Feedback | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you found copied contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
All rights reserved to DotNetFunda.Com. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks.
(Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher)