Exporting GridCheckBoxColumn to PDF

4 posts, 0 answers
  1. Marcus
    Marcus avatar
    8 posts
    Member since:
    Aug 2019

    Posted 31 Dec 2019 Link to this post

    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.

  2. Eyup
    Admin
    Eyup avatar
    4046 posts

    Posted 02 Jan 2020 Link to this post

    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.
  3. Marcus
    Marcus avatar
    8 posts
    Member since:
    Aug 2019

    Posted 03 Jan 2020 Link to this post

    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.

  4. Eyup
    Admin
    Eyup avatar
    4046 posts

    Posted 08 Jan 2020 Link to this post

    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.
Back to Top