We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

how to print SfDataGrid

hi,

I'm trying to print  SfDataGrid using this code:


             sfDataGrid1.PrintSettings = new PrintSettings();

            sfDataGrid1.PrintSettings.AllowRepeatHeaders = false;

            sfDataGrid1.Print();


and i get this error 

error CS1061: 'SfDataGrid' does not contain a definition for 'Print' and no accessible extension method 'Print' accepting a first argument of type 'SfDataGrid' could be found (are you missing a using directive or an assembly reference?)


please can someone guide me how to print the SfDataGrid




2 Replies

DM Dhanasekar Mohanraj Syncfusion Team February 6, 2023 01:53 PM UTC

Hi Moldoveanu,

Your requirement to print the SfDataGrid will be achievable by using PDF exporting and PrintDialog. For more information related to SfDataGrid Printing, please refer to the below knowledge base documentation link,

KB Links:

https://www.syncfusion.com/kb/9255/how-to-print-the-winforms-datagrid-sfdatagrid-control,

https://www.syncfusion.com/kb/9252/how-to-preview-winforms-datagrid-sfdatagrid-control-in-print-preview-dialog


Regards,
Dhanasekar M.



WI will April 3, 2023 07:48 AM UTC

Resolution

Click Start, point to Settings, and click Printers.

Right-click the appropriate printer, and then click Properties.

Click the Paper tab, then click the paper size you want to use in the Paper Size box.

Click OK, and then close the Printers folder.


Regards,

Diana


Loader.
Up arrow icon