1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Control Sitefinity caching from Widget / Usercontrol / Custom code

Control Sitefinity caching from Widget / Usercontrol / Custom code

4 posts, 0 answered
  1. Tys
    Tys avatar
    21 posts
    Registered:
    21 Jul 2011
    02 Apr 2012
    Link to this post
    Hi everyone,
    We have some widgets that prefer pages that don't use caching. Sometimes we forget to set this caching option to "none", and then data doesn't show as it should. Is there an option to set the caching settings/option of a page, through a widget that is dragged on to that page?

    Best regards, Tys
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    16 Aug 2017
    05 Apr 2012
    Link to this post
    Hi Tys,

    You can set the Page cacheability directly from your user control, for example by plugging in the OnInit event and saying:
    protected override void OnInit(EventArgs e)
            {
                this.Context.Response.DisableKernelCache();
                this.Context.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
                base.OnInit(e);
            }


    Kind regards,
    Boyan Barnev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Kunal Johar
    Kunal Johar avatar
    8 posts
    Registered:
    22 Jan 2010
    05 Apr 2012
    Link to this post
    This seems to update the cache on the entire page, not just the user control.

    Is there a way to only disable the cache for the user control?
  4. Tys
    Tys avatar
    21 posts
    Registered:
    21 Jul 2011
    05 Apr 2012
    Link to this post
    Looks like what i needed!
    Is there a way to do the same thing for the "Enable ViewState" setting?
    Thanks!
4 posts, 0 answered