Hi,
I have a print preview button under a search result ultraGrid. I want to print preview and print only the selected records in the ultraGrid.
I've achieved this in print preview, by adding following codes in the InitializePrintPreview event:
private void searchResultGrid_InitializePrintPreview(object sender, CancelablePrintPreviewEventArgs e) { // Hide the checkbox column e.PrintLayout.Bands[0].Columns["Select"].Hidden = true;
// Filter unselected records for printing. foreach (UltraGridRow row in e.PrintLayout.Rows) { if (row == null) continue; if (row.Cells == null) continue;
if (row.Cells["Select"].Text.ToLower().Equals("false")) row.Hidden = true; } }
Now the problem is, when I click the PRINT button on the Print Preview form, it still prints all the search result records.
so can anyone help me to filter the unselected records when click on PRINT button?
Thanks,
Nan
You can handle the BeforePrint event.