This example adds a custom action button to the Document Viewer that triggers a custom operation on the server side. The server-side custom operation exports a report to HTML and PDF, and emails the resulting documents.
When you run the application, you observe the Document Viewer with a newly added action button:
To email a report, click the button. The application attempts to send email to someone@test.com
using the localhost
SMTP server, port 25. Modify the code to apply your mail server settings.
The report sent by email is shown in the following image:
When the user clicks the 'Send via Email' button, the client-side PerformCustomDocumentOperation method passes data to the DocumentOperationService on the server. The service exports the report to PDF and HTML formats, creates the MIME message and sends email using the MailKIt client.
The PerformCustomDocumentOperation method returns an object that implements the IDocumentOperationResult interface, so you can return the data from the DocumentOperationService to the client.
- Global.asax.cs (VB: Global.asax.vb)
- CustomDocumentOperationService.cs (VB: CustomDocumentOperationService.vb)
- Viewer.cshtml (VB: Viewer.vbhtml)
- Reporting for WinForms - How to Use MailKit to Email a Report
- Reporting for Blazor - Email a Report from the Native Blazor Report Viewer
(you will be redirected to DevExpress.com to submit your response)