This is a migrated thread and some comments may be shown as answers.

Exporting GridCheckBoxColumn to PDF

3 Answers 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcus
Top achievements
Rank 1
Marcus asked on 01 Jan 2020, 12:24 AM

Hello all,

I have a grid with two checkboxcolumns that I am trying to export to PDF. The two columns are empty in the export, all other columns are populated. I have set ExportOnlyData="false", but that did not make any difference.

I should probably add that this is a grouped grid - not sure if that makes any difference.

Thx in advance for help and/or pointers!
M.

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 03 Jan 2020, 05:44 AM

Hello Marcus,

 

You can use the following approach to achieve this requirement:

 <telerik:GridCheckBoxColumn ... DataField="Active">
<MasterTableView ... DataKeyNames="OrderID,Active">
    protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
        if (RadGrid1.IsExporting)
        {
            foreach (GridDataItem item in RadGrid1.Items)
            {
                foreach (GridCheckBoxColumn col in RadGrid1.MasterTableView
                    .RenderColumns.OfType<GridCheckBoxColumn>())
                {
                    TableCell cell = item[col.UniqueName];
                    cell.Text = item.GetDataKeyValue(col.DataField).ToString();
                }
            }
        }
I hope this will prove helpful.

 

Regards,
Eyup
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Marcus
Top achievements
Rank 1
answered on 03 Jan 2020, 05:51 PM

Hi Eyup,

thx for the reply.

This puts the words "true" and "false" into the columns, correct? So, I gather there is no way to render the checkboxes on the pdf export ?

Thx again - M.

0
Eyup
Telerik team
answered on 08 Jan 2020, 03:06 PM

Hello Marcus,

 

Yes, this is correct. Exporting checkboxes is not supported with RadGrid.

Telerik also provides the Document Processing libraries which you can check:
https://demos.telerik.com/aspnet-ajax/pdfprocessing/overview/defaultcs.aspx

And it has many capabilities, even exporting and importing active fields:
https://demos.telerik.com/aspnet-core/pdfprocessing/read-write-form-fields

But building the resulting PDF file is a custom process and is beyond our support scope.

 

Regards,
Eyup
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
Tags
Grid
Asked by
Marcus
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Marcus
Top achievements
Rank 1
Share this question
or