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

Forums / General Discussions / User Control Caching

User Control Caching

2 posts, 0 answered
  1. Torbjorn
    Torbjorn avatar
    7 posts
    Registered:
    14 May 2009
    20 Oct 2010
    Link to this post
    Hello.
    I'm having trouble getting my user controls to work on the Sitefinity 4 Beta-2 installation when I
    add a <%@ OutputCache Duration="3600" VaryByParam="none" %> directive.
    The error message is:
    Exception Details: System.Reflection.TargetException: Object does not match target type.

    The caching works fine outside Sitefinity, and if I don't create any public variables for the control all looks fine too.
    Any ideas?
    Thanks
    Torbjorn

    --------------------------------------------------
    MyUserControl.ascx:

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyUserControl.ascx.cs"
        Inherits="CustomControls_MyUserControl" Debug="True" %>
    <%@ OutputCache Duration="3600" VaryByParam="none" %>

    <div>
        This is the User Control text.<hr />
        First Name:
        <asp:Label ID="lblFirstName" runat="server" Font-Bold="true"></asp:Label><br />
    </div>

    MyUserControl.ascx.cs:

     

    using

     

    System;

     

     

     

    using

     

    System.Collections.Generic;

     

     

     

    using

     

    System.Linq;

     

     

     

    using

     

    System.Web;

     

     

     

    using

     

    System.Web.UI;

     

     

     

    using

     

    System.Web.UI.WebControls;

     

     

     

    public

     

    partial class CustomControls_MyUserControl : System.Web.UI.UserControl

     

    {

     

      public string m_FirstName = string.Empty;

     

     

      private string m_LastName = string.Empty;

     

     

      private int m_Age = 0;

     

     

     

      # region

     

    Properties

     

     

      public string FirstName

     

      {

     

        get { return m_FirstName; }

     

     

        set { m_FirstName = value; }

     

      }

     

     

      #endregion

     

    Properties

     

     

      protected void Page_Load(object sender, EventArgs e)

     

      {

        lblFirstName.Text = m_FirstName;

      }

    }

     


  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    22 Oct 2010
    Link to this post
    Hi Torbjorn,

    Thank you for using our services.

    Unfortunately caching is not yet supported in Sitefinity 4.0, We plan on having support for caching for the official resale of Sitefinity.

    Kind regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered