Go to DotNetFunda.com
<<= Please see left side tutorials menu.


Silverlight Tutorials | Report a Bug in the Tutorial

Found interesting? Add this to:

| More

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: 9/3/2010 4:18:57 AM DateTime using Cachced: 9/3/2010 4:18:57 AM

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 | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you found plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 9/3/2010 4:18:57 AM