Hello, I am having a hard time getting this to work even after following solutions such as these:
http://docs.telerik.com/aspnet-mvc/helpers/grid/how-to/Export/detail-grid-export
I have a main grid, and detail grid that can go up to 5 levels down, and wish to export the child data as well as the main data in the same workbook. I have attached what my actual grid looks like in action (had to redact some text):
Main Grid:
@(Html.Kendo().Grid<...>()
.Name("...")
.Scrollable(s => s.Height("auto"))
.HtmlAttributes(new { @class = "hidden", style = "height: 100%" })
.Columns(columns =>
{
columns.Bound(...)
.ClientDetailTemplateId("gridTemplate")
.Events(e => e.DataBound("onMainGridDataBound").ExcelExport("onMainGridExcelExport").DetailInit("onMainGridDetailInit"))
.Sortable()
.Excel(xls => xls.FileName("Export.xlsx"))
.Pdf(pdf => pdf.FileName("Export.pdf"))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
...
})
.Group(...)
.Read(read => read.Type(HttpVerbs.Post).Action("..", "Grid").Data("..."))
.Events(events =>
{
events.RequestEnd("onMainGridRequestEnd");
events.Error("onError");
})
)
)
Detail Grid:
<script type="text/x-kendo-template" id="gridTemplate">
@(Html.Kendo().Grid<...>()
.Name("..._#=UniqueId#")
.Columns(columns =>
{
columns.Bound(...)
.Pageable()
.Sortable()
.Excel(xls => xls.FileName("Detail Export.xlsx"))
.ClientDetailTemplateId("gridTemplate")
.Events(e => e.DataBound("onMainGridDataBound").ExcelExport("onDetailGridExcelExport").DetailInit("onMainGridDetailInit"))
.ToClientTemplate()
)
</script>