Hi, thanks for the response.
What I don't understand is how to get the ViewBag or model info into the template. I've tried this:
Controller: ViewBag.Location = "Flagship store";
.cshtml, in the grid definition:
.Pdf(pdf => pdf
.AllPages()
.AvoidLinks()
.PaperSize("A4")
.Scale(0.75)
.Margin("2cm", "2cm", "1cm", "2cm")
.RepeatHeaders()
.TemplateId("inventory-template")
.FileName($"Inventory_{DateTime.Today.ToShortDateString()}.pdf")
.ProxyURL(Url.Action("Index", "Grid"))
)
And the template:
<script type="x/kendo-template" id="inventory-template">
<div class="inventory-template">
<div class="header">
Inventory of #: ViewBag.Location #
<span class="date-header"></span>
</div>
<div class="footer">
Sida #: pageNum # av #: totalPages #
</div>
</div>
</script>
This gives me a JavaScript runtime error: 'ViewBag' is undefined
If I replace the ViewBag with a model parameter I get the same error.
I am probably making a basic script syntax error, but I can't get it right. Can you please give me an indication of how it should be done?
Best regards,
Henrik