Blazor DataGrid Example - Print Functionality
Invoice No | Customer | Date | Status | Amount | Cost | Profit | Notes |
|---|
| INV-10001 | Northwind Traders | 2025-01-10 | Overdue | $4,200.00 | $3,024.00 | $1,176.00 | Past due - Follow up with account manager |
| INV-10002 | BluePeak Retail | 2025-01-15 | Pending | $4,675.00 | $3,366.00 | $1,309.00 | Repeat customer - Payment due in 12 days |
| INV-10003 | Harbor Logistics | 2025-01-20 | Overdue | $5,150.00 | $3,708.00 | $1,442.00 | Bulk shipment - Customs cleared |
| INV-10004 | Summit Health Systems | 2025-01-25 | Paid | $5,625.00 | $4,050.00 | $1,575.00 | Follow up required - Contract renewal review |
| INV-10005 | Silverline Manufacturing | 2025-01-30 | Pending | $6,100.00 | $4,392.00 | $1,708.00 | Large order - Production schedule approved |
| INV-10006 | Redwood Energy | 2025-02-04 | Pending | $6,575.00 | $4,734.00 | $1,841.00 | Awaiting approval from finance department |
| INV-10007 | Valley Electronics | 2025-02-09 | Paid | $5,910.00 | $4,255.20 | $1,654.80 | High-value order - Warranty included |
| INV-10008 | Cedar Grove Foods | 2025-02-14 | Overdue | $6,385.00 | $4,597.20 | $1,787.80 | Past due - Follow up with account manager |
| INV-10009 | Maple & Co. Holdings | 2025-02-19 | Overdue | $6,860.00 | $4,939.20 | $1,920.80 | Executive account - Invoice sent to finance |
| INV-10010 | Horizon Technologies | 2025-02-24 | Paid | $7,335.00 | $5,281.20 | $2,053.80 | Strategic partner - Add to preferred vendor list |
| INV-10011 | Northwind Traders | 2025-03-01 | Pending | $7,810.00 | $5,623.20 | $2,186.80 | Awaiting approval from finance department |
| INV-10012 | BluePeak Retail | 2025-03-06 | Overdue | $8,285.00 | $5,965.20 | $2,319.80 | Repeat customer - Payment due in 12 days |
This sample demonstrates the Blazor DataGrid printing feature using the Printing and Printed events for customizing the printed output and managing actions before and after the print operation.
The Printing event provides the following customization options:
PrintDataSource- Specifies a custom data source for printing instead of the Grid current data source.HeaderTemplate- Defines custom content to display in the printed document header.FooterTemplate- Defines custom content to display in the printed document footer.Cancel- Cancels the print operation programmatically when required.
The Printed event triggers after the print operation is initiated and can be used for post-print processing and restoration of temporary Grid changes.
In this example, the Printing event performs the following actions:
- Assigns a custom data source through
PrintDataSourceto print only paid invoices. - Hides sensitive columns such as Cost, Profit, and Notes.
- Generates custom header and footer templates with dynamically calculated summary information.
The Printed event restores the column visibility after the print operation completes.
Click the toolbar Print button to start the print process. The DataGrid prepares the configured print content and opens the browser's print dialog, allowing users to preview and print the data.
For more information about DataGrid printing, refer to the print documentation.
To learn more about the Blazor DataGrid, including features, documentation, and pricing, visit the Blazor DataGrid component page.