Export PDF all pages not working

3 posts, 1 answers
  1. Jokull
    Jokull avatar
    15 posts
    Member since:
    Oct 2016

    Posted 07 Nov 2017 Link to this post

    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. Answer
    Stefan avatar
    3067 posts

    Posted 09 Nov 2017 Link to this post

    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.
  3. Jokull
    Jokull avatar
    15 posts
    Member since:
    Oct 2016

    Posted 09 Nov 2017 in reply to Stefan Link to this post

    Upgrading to 2017.3.1026 did the trick for me. Thanks!
Back to Top