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

Export PDF all pages not working

2 Answers 329 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Jokull asked on 07 Nov 2017, 02:13 PM

I am trying to export grid to PDF and I want it to export all pages. In my grid I have 2 pages but pdf only shows first page. In the grid dataSource I have set ServerOperation(true) and what happens is that the read action is called 3 times, first time the request is marked page 1, second time the request is marked page 2 and then the third time the request is marked page 1 again and therefore it only exports the first page.

Here's my grid:

.Columns(columns =>
columns.Bound(c => c.ID).Visible(false);
columns.Template(@<text></text>).ClientTemplate(@"<div class=''>"
+ "# if (HasAllergies) { # <i id='al-#=ID#' class=\"fa fa-exclamation-circle allergies\" data-tooltiptext='#=Allergies#' aria-hidden=\"true\"></i> # } #"
+ "</div>").Width(20).HtmlAttributes(new
style = "padding-left:5px;padding-right:5px"
columns.Bound(c => c.NAME).Title(translator.Translate("NAME"));
columns.Bound(c => c.SSN).Title(translator.Translate("SSN"));
columns.Bound(c => c.GENDER).Title(translator.Translate("GENDER"));
columns.Bound(c => c.AGE).Title(translator.Translate("AGE"));
columns.Template(@<text></text>).ClientTemplate(@"<div class='dropdown'>"
+ "<a data-toggle='dropdown' class='primarycolor' href=''><i class='fa fa-ellipsis-v fa-2x'></i></a>"
+ "<ul class='dropdown-menu dm-icon pull-right'>"
+ "<li><a class='k-button-icontext k-grid-edit' href='" + Url.Action("Edit", "Members") + "/#=ID#'>" + translator.Translate("EDIT") + "</a></li>"
+ "<li><a class='k-button-icontext' href='##'>" + translator.Translate("REGISTER_CLASS") + "</a></li>"
+ "</ul>"
+ "</div>").HtmlAttributes(new
@class = "dropdown-gridcell"
.ToolBar(toolbar =>
<a class="k-button k-button-icontext k-grid-add" href="@Url.Action("", "")"><i class="fa fa-plus" aria-hidden="true"></i> @translator.Translate("ADD") @translator.Translate("PARTICIPANT_TGF")</a>
<a class="k-button k-button-icontext k-grid-excel" href="#"><span class="k-button-icontext k-i-excel"></span>Excel</a>
<a class="k-button k-button-icontext k-grid-pdf" href="#"><span class="k-icon k-i-pdf"></span>PDF</a>
.Pdf(pdf => pdf
.Margin("2cm", "1cm", "1cm", "1cm")
.FileName(string.Format("{0}_{1}.pdf", User.Identity.GetOrgName().Replace(' ', '_'), translator.Translate("PARTICIPANTS_PDFNAME")))
.ProxyURL(Url.Action("Pdf_Export_Save", "PDF"))
.Groupable(g => g.Messages(m => m.Empty(translator.Translate("DRAG_DROP_TO_ZONE_GROUPING"))))
.Filterable(filterable => filterable
.Messages(m => m.Clear(translator.Translate("CLEAR")).Filter(translator.Translate("FILTER")))
.Operators(operators => operators
.ForString(str => str.Clear()
.DataSource(dataSource => dataSource
.Read(read => read.Action("Participants_Read", "Participants").Data("additionalData"))
.Model(model => model.Id(mid => mid.ID))
.Create(update => update.Action("Participants_Create", "Participants"))


Here's my template:

<script type="x/kendo-template" id="page-template">
    <div class="page-template">
        <div class="header">
            <div style="float: right">Page #: pageNum # of #: totalPages #</div>
        <div class="watermark">SAVI VEFKERFI</div>
        <div class="footer">
            Page #: pageNum # of #: totalPages #

And here's my controller action:

public ActionResult Participants_Read([DataSourceRequest] DataSourceRequest request, int? did, int? sdid, int? cid, int? sid)
    List<MembersViewModel> list = memberRepository.GetParticipantMembersList(this.saviSite.OrgId, did, sdid, cid, sid);

    return Json(list.ToDataSourceResult(request));


Can you tell me what I'm doing wrong here? Thanks!

2 Answers, 1 is accepted

Sort by
Telerik team
answered on 09 Nov 2017, 07:21 AM
Hello, Jokull,

Thank you for the provided details.

Having three requests in this scenario is expected as the first two are for the exported Grid, and the last one is to load again the Grid current page. This can be observed in our demo as well:

I noticed that in the ToolBar there are buttons for the PDF and Excel exports and then the built-in buttons are also used.

In general, the provided code looks good and should not cause the mentioned issue, could you please share a runnable example, so we can investigate what may be causing it?

Also, please advise if the used version is indeed 2017.3.1026 as we had a similar issue in one of the older versions of Kendo UI?

Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Top achievements
Rank 1
answered on 09 Nov 2017, 03:28 PM
Upgrading to 2017.3.1026 did the trick for me. Thanks!
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Top achievements
Rank 1
Share this question