简体   繁体   中英

ASP.NET Charting and User Control Output Caching

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.

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

[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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM