I was exporting to Excel just fine in Chrome when I started using this product. Now I get an "Aw, Snap" error anytime I do it. Firefox works just fine. I cleared cache/cookies, disabled virus scanner, rebooted machine, even reinstalled Chrome.
Here is the grid code:
this.Html.Kendo().Grid<EmployeeHistoryGridVM>()
.Name("grid")
.Filterable()
.ColumnMenu(x => x.Filterable(true))
.Sortable()
.Groupable()
.ToolBar(toolbar =>
{
toolbar.Excel();
//toolbar.Custom().Name("foo").Text("Perform Action").Action("PerformAction", "EmployeeHistory");
//toolbar.Template(x => { this.Html.Write("test"); });
})
.Scrollable(scrollable => scrollable.Height(430))
.Columns(col =>
{
col.Bound(x => x.Id).Width(120).Sortable(false).Locked();
col.Bound(x => x.CategoryName).Width(120).Sortable(true);
col.Bound(x => x.CompanyName).Width(120).Sortable(true).Filterable(true);
col.Group(g =>
g.Title("Month 12th Count")
.HeaderHtmlAttributes(new { style = "text-align: center;"})
.Columns(c =>
{
c.Bound(x => x.Month1_12Count).Title("Month 1").Filterable(true).HeaderHtmlAttributes(new { style = "white-space: normal"}).Width(120);
c.Bound(x => x.Month2_12Count).Title("Month 2").Filterable(true).HeaderHtmlAttributes(new { style = "white-space: normal" }).Width(120);
c.Bound(x => x.Month3_12Count).Title("Month 3").Filterable(true).HeaderHtmlAttributes(new { style = "white-space: normal" }).Width(120);
}));
col.Bound(x => x.Month1).Filterable(true).Width(120);
col.Bound(x => x.Month2).Filterable(true).Width(120);
col.Bound(x => x.Month3).Filterable(true).Width(120);
col.Bound(x => x.PayCycleCode).Sortable(true).Filterable(true).Width(120);
col.Bound(x => x.Quarter).Sortable(true).Filterable(true).Width(120);
col.Bound(x => x.TaxCode).Sortable(true).Filterable(true).Width(120);
col.Bound(x => x.Year).Sortable(true).Filterable(true).Width(120);
})
.Excel(excel => excel
.FileName("test.xlsx")
.Filterable(true)
.AllPages(true)
//.ForceProxy(true)
.ProxyURL(Url.Action("Export_Save", "EmployeeHistory")))
.Filterable()
.Resizable(x => x.Columns(true))
.Reorderable(x => x.Columns(true))
//.Events(e => { e.ColumnMenuInit("filterMenuInit"); })
.Pageable(pageable => pageable
.ButtonCount(5)
.Info(true))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(50)
.Read(read => read.Action("GetData", "EmployeeHistory").Data("sendAntiForgery")))
.ToHtmlString();
And here is the Controller code:
[HttpPost]
public ActionResult Export_Save(string contentType, string base64, string fileName)
{
var fileContents = Convert.FromBase64String(base64);
return File(fileContents, contentType, fileName);
}
public ActionResult GetData([DataSourceRequest]DataSourceRequest request)
{
//request.Deflatten(EmployeeHistoryGridVM.KendoDBMapping);
IQueryable<ViewCompanyStatus> details = this.DataManager.AppDataContextManager.GetViewCompanyStatusRepository()
.Find(x => x.Id != 0) as IQueryable<ViewCompanyStatus>;
Func<ViewCompanyStatus, HistoryCompanyStatsGridVM> InfoFactory = delegate(ViewCompanyStatus model)
{
return new HistoryCompanyStatsGridVM
(
model
);
};
DataSourceResult result = details.ToDataSourceResult(request, x => InfoFactory(x));
// large data sets will blow us the F up for export
//JsonResult r = Json(result, JsonRequestBehavior.AllowGet);
var serializer = new JavaScriptSerializer { MaxJsonLength = Int32.MaxValue };
var result2 = new ContentResult
{
Content = serializer.Serialize(result),
ContentType = "application/json"
};
return result2;
}
Thanks in advance!