Dear Sir/Madam,
i am using telerik ajax dll version (Telerik.web.ui.dll) 2019.1.215.45 in asp.net application. i
have dynamically created radgrid which has more than 70 rows, so when i am
trying to export radgrid to pdf using RadClientExportManager [exporting html
content to pdf]. The lengthy radgrid is not continuing to next page in pdf. the
first 50 rows are printed in first page the rest of the rows are not getting
printed in second page.
4 Answers, 1 is accepted
Hello Narendra,
The page break export of the RadGrid needs custom implementation and taking into consideration the height of the row requires custom logic depending on the requirements.
Here is a CodeLibrary project that shows how to add the page break: https://www.telerik.com/support/code-library/page-for-client-side-export.
I have modified the addPageBreakSelectorsToGrid function to add a page break based on the height of the rows. Attached is the sample project I used to test this functionality.//loop the grid elements and add page break selectors and also clone the headers//you can modify further as needed, for example, just addClass to certain row elementsfunction addPageBreakSelectorsToGrid(itemsPerPage) {    var grid = $find("<%=RadGrid1.ClientID%>");    var items = grid.get_masterTableView().get_dataItems();    var totalHeight = 0;    for (var i = 1; i < items.length; i++) {        var rowHeight = items[i - 1].get_element().getBoundingClientRect().height;            totalHeight = totalHeight + rowHeight                //if (i > 0 && i % itemsPerPage == 0) {        if (totalHeight > 700) { // if the height exceeds the page height, add a pagebreak            totalHeight = 0;            //add a page break every nth item, you can use the original page size here if you like            var breakRow = '<tr class="pageBreak">';            //clone the header so the subsequent pages show a header to the consumer            for (var j = 0; j < grid.get_masterTableView().get_columns().length; j++) {                breakRow += '<td class="rgHeader">' + grid.get_masterTableView().get_columns()[j].get_uniqueName() + '</td>';            }            breakRow += '</tr>';            $telerik.$(breakRow).insertAfter(items[i-1].get_element());        }    }}Let me know if you have any other questions related to the built-in functionality and API of our controls.
Regards,
 Peter Milchev
 Progress Telerik
    

Hi Peter,
thank you for you reply. for now I am using window.print(). let me try your reply in future and will get back to you. :)

Hello Narendra,
There is a built-in ClientSettings-EnableClientPrint functionality that autobreaks the Grid but does not add the headers on every page.
Also, the ClientExportManager and the RadGrid are two different controls, so additional code is needed to achieve such a customization.
The good thing is that the code is already available and what you need to do to have the functionality is just to paste and reuse the code.
Regards,
 Peter Milchev
 Progress Telerik
    
