Copied to clipboard

Flag this post as spam?

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


  • Harry Kakoulidis 17 posts 40 karma points
    Feb 14, 2011 @ 15:01
    Harry Kakoulidis
    0

    Macro cache in usercontrol

    Hi! I'm following the Macro Caching video in umbraco.tv and recreated the example in it.

    -------html--------- 
    <p>
    <% = System.DateTime.Now.ToString("G") %>
    </p>
    <p>
    <asp:Literal ID="Dt" runat="server" />
    </p>

    ---- c# ----------
    protected void Page_Load(object sender, EventArgs e)
    {
    Dt.Text = DateTime.Now.ToString("G");

    This works ok without caching in the Macro. But if I enable caching:

    • The first time it runs it's ok
    • But on cached output, the output of the codebehind (The literal control's text) is not cached, so in the next refresh the literal gets replaced with it's default value (null string)
    • Also on each reload, the following is not updated, but the time of the original usercontrol creation time is shown:
      <% = System.DateTime.Now.ToString("G") %>

    But watching the video in umbraco.tv, the video seems to suggest that on each refresh, the

    <% = System.DateTime.Now.ToString("G") %>

    should be replaced with the current time regardless whether caching was used or not, and also the value in Dt created by code the first time should be displayed. What am I doing wrong here? Thanks!

     

  • Peter Gregory 408 posts 1614 karma points MVP 3x admin c-trib
    Feb 15, 2011 @ 07:58
    Peter Gregory
    0

    Hi Harry

    This is a known bug in Umbraco 4.6.1 and will be fixed in the upcoming release 4.6.2 out next week hopefully.

    Peter

     

Please Sign in or register to post replies

Write your reply to:

Draft