views:

633

answers:

2

I'm using the new asp.net 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 asp.net charting control?

Thanks,

Martin.

+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: http://msdn.microsoft.com/en-us/library/18c1wd61(VS.80).aspx

Adding items to the cache: http://msdn.microsoft.com/en-us/library/system.web.caching.cache.add.aspx

To retrieve from the cache: http://msdn.microsoft.com/en-us/library/system.web.caching.cache.item.aspx

Does that help, or am I off-base?

Carl
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.
Martin
A: 

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

zrytane