Current filter:
                                You should refresh the page.
                                Support Center

                                How to use the caching functionality of the Document Viewer

                                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 ASP.NET MVC - How to emulate the caching functionality of an ASPxDocumentViewer.

                                • Luigi Renzi 04.02.2013

                                  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?

                                • Adam Caviness 01.28.2014

                                  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.

                                • 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.

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

                                • Adam Caviness 01.30.2014

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

                                • You are always welcome, Adam!

                                You must  log in  or  register  to leave comments
                                Select file
                                • Default.aspx
                                • Default.aspx.cs
                                • XtraReport1.cs
                                Select language
                                • C#
                                • VB.NET
                                Select version
                                • v2013 vol 2.5 - v2013 vol 2.9
                                • v2011 vol 1.6 - v2013 vol 1.10
                                • v2009 vol 1.9 - v2011 vol 1.5
                                <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
                                
                                <%@ Register Assembly="DevExpress.XtraReports.v13.2.Web, Version=13.2.0.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4"
                                    Namespace="DevExpress.XtraReports.Web" TagPrefix="dxxr" %>
                                
                                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                                
                                <html xmlns="http://www.w3.org/1999/xhtml" >
                                <head runat="server">
                                    <title>Untitled Page</title>
                                </head>
                                <body>
                                    <form id="form1" runat="server">
                                    <div>
                                        <dxxr:ASPxDocumentViewer ID="DocumentViewer1" runat="server" OnCacheReportDocument="DocumentViewer1_CacheReportDocument" OnRestoreReportDocumentFromCache="DocumentViewer1_RestoreReportDocumentFromCache">
                                        </dxxr:ASPxDocumentViewer>
                                    </div>
                                    </form>
                                </body>
                                </html>

                                To start a chat you should create a support ticket


                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners