Telerik Kendo网格导出到Excel不会响应当试图导出超过4000logging到Excel

剑道网格导出为Excel无法响应当试图导出超过4000logging到Excel …甚至没有抛出一个错误信息…有人请咨询或build议为此解决。

这是Kendo网格的代码

@(Html.Kendo().Grid(Model) .Name("Billinggrid") .Columns(columns => { columns.Bound(c => c.groupid).Width(75).Filterable(true).Sortable(true).HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }); columns.Bound(c => c.groupname).Width(125).Filterable(true).Sortable(true).HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }); columns.Bound(c => c.groupeffectivedate).Width(90).Filterable(true).Sortable(true).HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }); columns.Bound(c => c.recipientdatareceived).Width(95).Filterable(true).Sortable(true).HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }); columns.Bound(c => c.recipientsent).Width(100).Filterable(true).Sortable(true).HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }); columns.Bound(c => c.accountmanager).Width(125).Filterable(true).Sortable(true).HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }); columns.Bound(c => c.billinggroup).Width(75).Filterable(true).Sortable(true).HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }); columns.Bound(c => c.reportyearmonth).Width(85).Filterable(true).Sortable(true).HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }); columns.Bound(c => c.recordcount).Width(55).Filterable(false).Sortable(true).HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }); columns.Bound(c => c.datafilecount).Width(50).Filterable(false).Sortable(true).HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }); columns.Bound(c => c.datacharge).Format("{0:c}").Filterable(false).Sortable(false).HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }); columns.Bound(c => c.printcharge).Format("{0:c}").Filterable(false).Sortable(false).HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }); columns.Bound(c => c.insertcharge).Format("{0:c}").Filterable(false).Sortable(false).HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }); columns.Bound(c => c.envelopecharge).Format("{0:c}").Filterable(false).Sortable(false).HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }); columns.Bound(c => c.postage).Format("{0:c}").Filterable(false).Sortable(false); columns.Bound(c => c.total).Format("{0:c}").Filterable(false).Sortable(false); columns.Bound(c => c.postageremaining).Width(95).Format("{0:c}").Filterable(true).Sortable(true).HeaderHtmlAttributes(new { style = "overflow: visible; white-space: normal" }); }) .Resizable(resizable => resizable.Columns(true)) .Reorderable(reorderable => reorderable.Columns(true)) .Pageable(pager => pager.PageSizes(new int[] { 10, 25, 50, 100, 500 }) .Messages(messages => messages.ItemsPerPage(" items displayed")) ) .Sortable() .Scrollable(scr => scr.Height("auto")) .HtmlAttributes(new { style = "Font-size:x-small" }) //.ToolBar(tools => tools.Excel()) .Excel(excel => excel .FileName("Billing_Report-" + DateTime.Now + ".xlsx") .AllPages(true) //.Filterable(true) .ProxyURL(Url.Action("Excel_Export_Save", "Report")) ) //.Filterable(ftb => ftb.Mode(GridFilterMode.Row)) .ToolBar(toolbar => 

从telerik论坛系统内存不足的post

当OpenAccess执行一个查询时,结果的实际检索被拆分成块。 有一个获取大小,它决定了单次传递从数据库中读取的logging数。 对于返回大量logging的查询,这意味着不会超过读取大小,并且不会在内存中同时检索全部40 000条logging。 迭代结果数据,直到迭代结束,您将从数据库中读取几次。 但是,在遍历结果集时,如果继续引用迭代的对象,则会累积后续读取。 当您使用网格中的所有logging进行操作时,可能会导致内存不足exception。 避免出现这种错误的方法是使用块来处理数据。 例如,网格的分页和从所有页面顺序导出数据的选项将实现这一点。 目标是尽量减less一次保存在内存中的对象,并让垃圾回收释放不需要的内存。 在这种情况下,使用Skip()和Take()进行LINQ查询是很理想的。