Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jon 92 posts 166 karma points
    Nov 11, 2020 @ 14:04
    Jon
    0

    Hi,

    Is it possible to Cache Grid blocks or even Cache HTML.GetGridHTML?

    I have a block on a template which I need to cache.

    Jon

  • Steve Morgan 1346 posts 4453 karma points c-trib
    Nov 12, 2020 @ 17:52
    Steve Morgan
    0

    Hi, Yes - just create a partial that takes your model and does the grid call then you can just use the cached partial call in your template:

    So change your call for the Get Grid to:

    @Html.CachedPartial("Grid/CacheForGrid", Model, 3600, true, false)
    

    Then create a partial called CacheForGrid

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @Html.GetGridHtml(Model.Content, "GridContent", "mycustomrenderer")
    

    That was from a v7 project but hopefully you get the idea.

    Steve

Please Sign in or register to post replies

Write your reply to:

Draft