The requested page is not available for the requested platform. You are viewing the content for Default platform.
A newer version of this page is available. Switch to the current version.

Format-Specific Preview Actions in ASP.NET Applications

  • 4 min to read

To allow end-users to preview a report, the PreviewInReportViewerAction is implemented in the ASP.NET Reports Module. This Action is executed when clicking a report in the Report List View. The invoked Preview window contains a Detail View with a single View Item (see Reports Module in ASP.NET Applications). This Item is displayed by a panel that contains the ReportViewer control and two ReportToolbars at the top and at the bottom. The Report Viewer shows a report. The Report Toolbar provides end-user capabilities that are common to Preview windows. For instance, saving, searching, printing and so on. When saving a report, you will be able to choose the format of the created file. In addition to the PreviewInReportViewerAction, the ASP.NET Reports Module contains Actions that allow you to preview a report in a particular format. These Actions are not activated by default. This topic details how to activate them and set one of them as a default Action that is executed when a report is clicked in the Report List View.

There are the following format-specific Preview Actions.

  • PreviewInMhtAction

    Previews a report in a MHT format.

  • PreviewInPdfAction

    Previews or saves a report as a PDF.

  • PreviewInXlsAction

    Previews or saves a report in an XLS format.

  • PreviewInRtfAction

    Previews or saves a report as an RTF.


To activate these Actions, invoke the Application Designer for the ASP.NET application project and select the ReportsAspNetModule. In the Properties window, set the ReportsAspNetModule.ShowFormatSpecificPreviewActions property to true (by default, it is set to false).


By default, the PreviewInReportViewerAction is executed when clicking a report in the Report List View, because it is set as a default Action for this List View (see ListView.ProcessSelectedItem). When you make the format specific Preview Actions visible, you can set any of them as a default Action for the Report List View. To do this, invoke the Application Designer and select the ReportsAspNetModule. In the Properties window, set the ReportsAspNetModule.DefaultPreviewFormat property to Mht, Pdf, Xls or Rtf (by default, it is set to ReportViewer).


All the Actions listed above (PreviewInReportViewerAction, PreviewInMhtAction, PreviewInPdfAction, PreviewInXlsAction and PreviewInRtfAction) are contained in the DevExpress.ExpressApp.Reports.Web.ReportsController, located in the ASP.NET Reports Module. You can customize the settings of these Actions in code, accessing the required Action via the Controller.Actions property of the ReportsController (see Frame.GetController<ControllerType>). In the Application Model, these Actions are defined via the corresponding ActionDesign | Actions | <Action> nodes.

You can activate the format-specific Preview Actions for particular List Views only. For this purpose, implement a View Controller in your ASP.NET module, access the DevExpress.ExpressApp.Reports.Web.ReportsController and invoke its SetFormatSpecificPreviewActionsVisible method. Pass true as the method's parameter if the current View is the target one. The code below demonstrates how to perform this task. Each time the ReportsWithInlinePreviewActionsController Controller is activated, it accesses the ReportsController, and activates format specific Preview Actions for this List View using the SetFormatSpecificPreviewActionsVisible method.

using DevExpress.ExpressApp.Reports.Web;
public class ReportsWithInlinePreviewActionsController : ViewController {
   public const string ListViewId = "ReportsWithInlinePreviewActions_ListView";
   protected override void OnActivated() {
      ReportsController controller = Frame.GetController<ReportsController>();
      if (controller != null) {
          controller.SetFormatSpecificPreviewActionsVisible(View.Id == ListViewId);

Format-specific Preview Actions are only designed for the fast export of a report to a particular format. So don't use these Actions for reports with end-user-specified parameters (e.g., the reports that use the ReportParametersObjects or XtraReports native parameters). To preview reports with end-user-specified parameters, use the PreviewInReportViewer Action and then the Export Action in it, selecting the required export format.

The format specific Preview Actions are demonstrated in the FeatureCenter demo application, shipped with the XAF installation. This demo is located in the %PUBLIC%\Documents\DevExpress Demos 18.2\Components\eXpressApp Framework\FeatureCenter folder by default.

See Also