I want to generate Excel after clicking a custom button(not export button) from Kendo grid and Save the file.
Pls Help me.
You can have a custom button in the grid
.ToolBar(tools =>
{
tools.Custom().Text("Export to Excel").HtmlAttributes(new { @class = "exporTtoExcelClass" });
})
And on the grid bound function you need to add function
function Grid_DataBound() {
var grid = $('#YourGrid').data('kendoGrid');
var exportButton = grid.element.find(".exporTtoExcelClass");
exportButton.unbind("click");
exportButton.on("click", function (args) {
kendo.ui.progress($("#YourGrid"), true);
var grid1 = $("#YourGrid").data("kendoGrid");
grid1.saveAsExcel();
kendo.ui.progress($("#YourGrid"), false);
return false;
});
}