Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to use the caching functionality of the Document Viewer

$
0
0

This example illustrates how to make the ASPxDocumentViewer store its document on the client between postbacks.

Upon the request to preview, export, or print the document, the Document Viewer restores it from the Page cache, instead of performing a round trip to the server, requesting for a new document copy.

The Document Viewer manages a cached document during the CacheReportDocument and RestoreReportDocumentFromCache events.

For an MVC approach to solving this task, see How to use the built-in caching functionality of the ASP.NET MVC Document Viewer.

Note: No document caching is required when using the newer ASPxWebDocumentViewer control that utilizes the HTML5/JS technology and provides asynchronous building of documents out of the box.

Question Comments

Added By: Luigi Renzi at: 4/2/2013 7:15:54 AM    

How can it be possible to translate this sample to work with ReportViewerExtension in Asp.Net MVC?
How to get access to the underlying ReportViewer to wire up CacheReportDocument and RestoreReportDocumentFromCache events?

Added By: Adam Caviness at: 1/28/2014 1:29:02 PM    

According to this code, a new report instance is created on all postbacks. Was that really the intent of this new caching functionality? What about reports that use runtime data binding? I thought instantiating the report is what I'm trying to avoid.

Added By: Alex (DevExpress Support) at: 1/29/2014 3:34:31 AM    

Hi Adam,
There is nothing wrong in that the new XtraReport class instance is created. Please note that the report document isn't generated multiple times: only the report class instance is created. If you are using the Page_Load event to initialize the report data source, I suggest that you move this routine to the XtraReport.BeforePrint or DataSourceDemanded event handler.

Added By: Alex (DevExpress Support) at: 1/29/2014 3:35:42 AM    

Hi Luigi,
Please review the http://www.devexpress.com/example=E20059 in this regard.

Added By: Adam Caviness at: 1/30/2014 10:00:58 AM    

@Alex, thanks for the explanation and tip on DataSourceDemanded.

Added By: Alex (DevExpress Support) at: 1/30/2014 10:08:32 PM    

You are always welcome, Adam!


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>