I have a custom control that shows the value (product price) derived from the database. This value is stored in the cache for performance reasons and it works fine. However, in Visual Studio 2008 in Design mode, I get an error that says "Error presentation control. An unchecked exception has occurred. Cache is not available"
I am using a Control Designer I'm a lot simpler, GetDesignTimeHtml:
public override string GetDesignTimeHtml () {return "[$ 9.99]"; }
I hope this will correct the problem, but it is not.
You need to add a cover to your cache access for custom controls, otherwise they can be used in design mode Will fail when HttpContext The current zero is something you want to do something like this:
public object GetFromCache {string key} {var myContext = HttpContext.Current; Return (myContext! = Null) {myContext.Cache [Key]; } Return "[time of design time]"; }
Comments
Post a Comment