Printing Selected Records

Hi Community, 

Is it possible to only print selected records using GridPrintDocumentAdv? Any help would be much appreciated 

Thanks ! 

1 Reply 1 reply marked as answer

BT Balamurugan Thirumalaikumar Syncfusion Team May 27, 2021 11:44 AM UTC

Hi Mohammad, 

Thank you for interesting in Syncfusion products 

We have checked your query “Is it possible to only print selected records using GridPrintDocumentAdv? Any help would be much appreciated” at our end. As per the current implementation of GridGroupingControl does not have any direct support to print the selected records in print preview page. However, this can be achieved by creating a DataTable manually and adding selected records to a datatable. Populate the selected records datatable to a GridGrouping control and print the selected records in print preview page. You can refer the following code snippet to get the selected records in a datatable. 
 
Code Snippet 
public DataTable DataTable() 
{ 
    DataTable dt = new DataTable("SelectedRecordsTable"); 
    foreach (GridColumnDescriptor desc in this.gridGroupingControl1.TableDescriptor.Columns) 
    { 
        dt.Columns.Add(desc.Name); 
    } 
 
    for (int i = 0; i < this.gridGroupingControl1.Table.SelectedRecords.Count; i++) 
    { 
        DataRow dr = dt.NewRow(); 
        foreach (GridColumnDescriptor desc in this.gridGroupingControl1.TableDescriptor.Columns) 
        { 
            dr[desc.Name] = this.gridGroupingControl1.Table.SelectedRecords[i].Record.GetValue(desc.MappingName); 
        } 
        dt.Rows.Add(dr); 
    } 
    return dt; 
} 

We have attached the tested sample for your reference and you can download the same from the following location.  
Sample linkhttps://www.syncfusion.com/downloads/support/directtrac/general/ze/SelectedRecordsGGC781705695.zip

Please let us know if you would require any other assistance. we will be happy to assist you. 

Thanks & Regards, 
Balamurugan Thirumalaikumar

Marked as answer
Loader.
Up arrow icon