Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. OutputCache dynamically loaded UserControl.

OutputCache dynamically loaded UserControl.

Scheduled Pinned Locked Moved ASP.NET
designquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    theJazzyBrain
    wrote on last edited by
    #1

    Dear CPians, I am trying to enable OutpoutCache on a UserControl which is dynamically added to the page. I get an exception when I instantiate the UserControl. The code goes as follows: DisplayTime myUserControl; myUserControl = (DisplayTime)LoadControl("DisplayTime.ascx"); If I do not have an OutputCache directive it works fine. When I add the following: <%@ OutputCache Duration="20" VaryByParam="*" Shared="true" %> I get the following exception: System.InvalidCastException: Unable to cast object of type 'System.Web.UI.PartialCachingControl' to type 'TestApp.DisplayTime'. Any Ideas?

    Jason Kataropoulos

    Excellence is not an act, but a habit!

    Aristotle

    L 1 Reply Last reply
    0
    • T theJazzyBrain

      Dear CPians, I am trying to enable OutpoutCache on a UserControl which is dynamically added to the page. I get an exception when I instantiate the UserControl. The code goes as follows: DisplayTime myUserControl; myUserControl = (DisplayTime)LoadControl("DisplayTime.ascx"); If I do not have an OutputCache directive it works fine. When I add the following: <%@ OutputCache Duration="20" VaryByParam="*" Shared="true" %> I get the following exception: System.InvalidCastException: Unable to cast object of type 'System.Web.UI.PartialCachingControl' to type 'TestApp.DisplayTime'. Any Ideas?

      Jason Kataropoulos

      Excellence is not an act, but a habit!

      Aristotle

      L Offline
      L Offline
      l0kke
      wrote on last edited by
      #2

      Well, sometimes it is worth to ask google before posting anything here :) search for "Unable to cast object of type ‘System.Web.UI.PartialCachingControl’" and first link will be this: http://msdn.microsoft.com/msdnmag/issues/06/07/WebAppFollies/default.aspx Pilo

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups