Manage Exporting Capabilities
- 7 minutes to read
The ASP.NET Web Forms Dashboard control allows end-users to export an entire dashboard or individual dashboard items.
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. |
ASPxDashboardExporter Constructor | Initializes a new instance of the ASPxDashboardExporter class for the specified DashboardConfigurator instance. |
In the Web Forms, use the ASPxDashboardExporter class to perform server-side export of a dashboard/dashboard item.
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 Web Forms Dashboard Control. 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.
- The ASPxDashboard.CustomJSProperties server-side event is used to pass information about available dashboards to the client side.
- The ASPxClientDashboard.LoadDashboard method opens a selected dashboard.
- The ASPxClientDashboard.PerformDataCallback client-side method is used to pass the dashboard identifier and state to the server side. On the server side, the ASPxDashboard.CustomDataCallback event is used to obtain and parse these values.
- WebDashboardExporter.ExportToPdf is used to export the selected dashboard with the state passed from the client side.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/aspxdashboard-how-to-implement-server-side-export-t500219.
- InitializeControls.js (VB.NET)
- Default.aspx (VB.NET)
- Default.aspx.vb
- Default.aspx.cs
- InitializeControls.js (C#)
- Default.aspx (C#)
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);
};