I have a grid that contains a child detail spreadsheet. I am trying to duplicate some code I used from another Kendo Spreadsheet, but each spreadsheet and Export button needs to have a unique id. In the form I am using to export the Excel for the spreadsheet, I am using a Kendo Button to allow addition of the unique id (TplNum) from the parent grid. For some reason, the template is not valid when I add the Kendo Button. Any ideas?
I was going to use the Click event to determine the TplNum based on location of the button or the button id field in the Javascript callback, but thought that was giving me problems. Currently, I gave the buttons a class, "export_excel" and I'm trying to create a jQuery onClick function in my document.load, which is invoked based on class, rather than id.
$(document).ready(function () {$(".export_excel").click(function (e) {
}
}
<script id="campaign_template" type="text/kendo-tmpl">@using (Html.BeginForm("SpreadsheetDownload", "Campaign", FormMethod.Post, new { @class = "form-horizontal", role = "form", id = "spreadsheet_form_#=TplNum#" }))
{
@Html.Hidden("data", null, htmlAttributes: new { name= "data", id = "download-data_#=TplNum#" });
@Html.Hidden("extension", null, htmlAttributes: new { name = "extension", id = "download-extension_#=TplNum#" });
@(Html.Kendo().Button()
.Name("export_excel")
.HtmlAttributes(new { type = "button", id = "export_excel_#=TplNum#", @class = "export_excel" })
.Content("Export to Excel"));
//.Events(e => e.Click("ExportExcel")));
}
This is what I'm getting when the Kendo Button is not commented out: