This example demonstrates how to load a report to ASPxDocumentViewer control dynamically at runtime.
The ASPxDocumentViewer control uses a callback to display a report. According to the ASP.NET Page Life Cycle, the ASP.NET WebForms page state should be restored on all postbacks and callbacks. To make the ASPxDocumentViewer control work correctly, a report that was dynamically assigned to it should be restored when the page is reloaded on a callback.
Take special note that if the report is not restored on a callback, the ASPxDocumentViewer control remains empty after assigning a report to it.
In this code example, the Session variable is used to save the ASPxDocumentViewer state. When the page is loaded for the first time, the Session variable is not yet specified and the ASPxDocumentViewer remains empty. But after the button is clicked, the currently displayed report name is saved into the session (in the btPreview_Click event handler). Then, when the page is reloaded, this name is used to restore the report (in the Page_Load event handler).
↧
ASPxDocumentViewer - How to dynamically preview a report in document viewer after a button was clicked
↧