I have the following code in an MVC page. When I export to PDF, the content in the "page-template" script tag prints at the bottom of the grid on each page instead of the top, as I thought it should because I've specified a class type of "header".
<script type="x/kendo-template" id="page-template">
<div class="page-template">
<div class="header">
<div style="float: right">Page #: pageNum # of #: totalPages #</div>
Multi-page grid with automatic page breaking
</div>
</div>
</script>
<div id="main-content" class="JeffreysContainer">
<h3 class="text-center">Dealer Closeout History</h3>
@(Html.Kendo().Grid<JeffreysOnline.Entities.vwCloseout>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.CloseoutDate).Width(120).Format("{0:MM/dd/yyyy}");
columns.Bound(p => p.BeginDate).Width(120).Format("{0:MM/dd/yyyy}");
columns.Bound(p => p.EndDate).Width(120).Format("{0:MM/dd/yyyy}");
columns.Bound(p => p.BoothNumber).Title("Booth").Width(80);
columns.Bound(p => p.DealerName).Title("Dealer Name").Width(100);
columns.Bound(p => p.DealerId).Title("Dealer Id").Width(100);
columns.Bound(p => p.RetailSales).Width(125);
columns.Bound(p => p.WholesaleSales).Width(125);
columns.Bound(p => p.LayawayPayments).Title("Deposit Payments").Width(125);
columns.Bound(p => p.RentWithheld).Title("Rent").Width(125);
columns.Bound(p => p.CommissionWithheld).Title("Commissions").Width(125);
columns.Bound(p => p.ChargeCardFees).Title("Charge Fees").Width(125);
columns.Bound(p => p.AssessmentWithheld).Title("Asessment").Width(125);
columns.Bound(p => p.TotalPayout).Title("Total Payout").Width(125);
columns.Bound(p => p.CheckNumber).Title("Check Number").Width(125);
})
.ToolBar(toolbar =>
{
toolbar.Excel();
toolbar.Pdf();
})
.ColumnMenu()
.Excel(excel => excel
.FileName("CloseoutHistory.xlsx")
.Filterable(true)
.AllPages(true)
.ProxyURL(Url.Action("ExcelExport", "Customer"))
)
.Pdf(pdf => pdf
.AllPages()
.AvoidLinks()
.PaperSize("A4")
.Scale(0.6)
.Margin("2cm", "1cm", "1cm", "1cm")
.Landscape()
.RepeatHeaders()
.Title("Closeout History")
.TemplateId("page-template")
.FileName("CloseoutHistory.pdf")
.ProxyURL(Url.Action("PdfExport", "Dealer"))
)
.DataSource(dataSource => dataSource
.Ajax()
.Batch(false) // We want to perform batch operations
.PageSize(50) // Set the page size
.Events(events => events.Error("gridErrorHandler")) // Define a function that gets called on an error
.Read(read => read.Action("ReadCloseoutHistory", "Closeout")) // The Read method in the controller
)
)
</div>