Manage Exporting Capabilities

The Web Dashboard allows end-users to export an entire dashboard or individual dashboard items. You can also implement server-side exporting using the ASPxDashboardExporter class.

Server-Side API

The ASPxDashboard control's server-side API allows you to customize the default export options, customize export documents at runtime, etc.

API Description
ASPxDashboard.AllowExportDashboard

Gets or sets whether the entire dashboard can be exported by end-users.

ASPxDashboard.AllowExportDashboardItems

Gets or sets whether the dashboard items can be exported by end-users.

ASPxDashboard.PdfExportOptions

Provides access to options related to exporting a dashboard/dashboard item to the PDF format.

ASPxDashboard.ImageExportOptions

Provides access to options related to exporting a dashboard/dashboard item to an image.

ASPxDashboard.ExcelExportOptions

Provides access to options related to exporting a dashboard item to the Excel format.

ASPxDashboard.BeforeExportDocument

Allows you to hide specific dashboard items when exporting the entire dashboard.

ASPxDashboard.CustomExport

Allows you to customize the exported document.

ASPxDashboard.CustomizeExportDocument

Allows you to customize the exported document.

How to: Add Custom Information to the Exported Dashboard at Runtime using the CustomExport Event

Client-Side API

You can use the ASPxDashboard control's client-side API for exporting to various formats, customizing export options, etc.

API Description
ASPxClientDashboard.ExportToPdf

Exports a dashboard to a PDF file and writes it to the Response.

ASPxClientDashboard.ExportToImage

Exports a dashboard to an Image file and writes it to the Response.

ASPxClientDashboard.ExportToExcel

Exports dashboard data to the specified file in Excel format.

ASPxClientDashboard.ExportDashboardItemToPdf

Exports a dashboard item to a PDF file and writes it to the Response.

ASPxClientDashboard.ExportDashboardItemToImage

Exports a dashboard item to an Image file and writes it to the Response.

ASPxClientDashboard.ExportDashboardItemToExcel

Exports a dashboard item to an Excel file and writes it to the Response.

ASPxClientDashboard.GetPdfExportOptions

Allows you to obtain options related to exporting a dashboard/dashboard item to the PDF format.

ASPxClientDashboard.GetImageExportOptions

Allows you to obtain options related to exporting a dashboard/dashboard item to an image.

ASPxClientDashboard.GetExcelExportOptions

Allows you to obtain options related to exporting a dashboard/dashboard item to the Excel format.

ASPxClientDashboard.SetPdfExportOptions

Allows you to specify options related to exporting a dashboard/dashboard item to the PDF format.

ASPxClientDashboard.SetImageExportOptions

Allows you to specify options related to exporting a dashboard/dashboard item to an image.

ASPxClientDashboard.SetExcelExportOptions

Allows you to specify options related to exporting a dashboard/dashboard item to the Excel format.

ASPxClientDashboard.ShowExportDashboardDialog

Invokes the dialog that allows end-users to export the entire dashboard to the specified format.

ASPxClientDashboard.ShowExportDashboardItemDialog

Invokes the dialog that allows end-users to export the dashboard item to the specified format.

How to: Add Custom Information to the Exported Dashboard at Runtime using the CustomExport Event

Implement Server-Side Export

The ASPxDashboardExporter class allows you to implement server export for the ASP.NET Dashboard Control and ASP.NET MVC Dashboard Extension. It uses information stored in a dashboard state to determine the currently selected filters, drill-down levels and parameter values. The state overrides default values specified in dashboard items and parameters. Export methods allow you to specify a dashboard state and export options for the resulting document. Refer to the ASPxDashboardExporter class description for more information.

This example demonstrates how to export a dashboard displayed in ASPxDashboard on the server side using the ASPxDashboardExporter class. The following API is used to implement this capability.

function initializeControls() {
    $("#buttonContainer").dxButton({
        text: "Export to PDF",
        onClick: function (param) {
            var selectedDashboardID = webDashboard.GetDashboardId();
            var dashboardState = webDashboard.GetDashboardState();
            var parameters = selectedDashboardID + "|" + dashboardState;
            webDashboard.PerformDataCallback(parameters, null);
        }
    });

    $("#selectBox").dxSelectBox({
        dataSource: getDashboardIDs(),
        value: getDashboardIDs()[0],
        onValueChanged: function (param) {
            webDashboard.LoadDashboard(param.value);
        }
    });
}

function getDashboardIDs() {
    return webDashboard.cpGetDashboardIDs;
};

function dashboardExportedSuccess(args) {
    DevExpress.ui.notify('A dashboard was exported to ' + args.result, 'success', 5000);
};