I'm using the new chart control within a user control. I tried to use the output cache directive to cache the user control for 30 seconds. The caching is custom depending on the logged in user.

The chart data is being lost while the control is cached. I see the chart one every 30 seconds but at no point inbetween. Am I missing some cache option for the charting control?



+2  A: 

[I guess I'll add my comment as an answer, in case it answers your question]

You're using the <% @OutputCache ... %> page directive? If so, that caches the page's output (ie the html), and will not retrieve datasources, or databind again until expiration of the cache. If you wanted to cache the datasource for your chart, you'd need to do that in code-behind:

Caching Reference:

Adding items to the cache:

To retrieve from the cache:

Does that help, or am I off-base?

Thanks carl, I think this is probably the route I'll have to take. I believe the issue is due to the chart image not being stored. I'll have to keep looking.

You can set ImageStorageMode property to UseImageLocation. More information about image file management you can find here.