New to Telerik UI for ASP.NET MVC? Download free 30-day trial

Excel Export

This article provides solutions for issues you might encounter while exporting the content of the Telerik UI Grid component for ASP.NET MVC.

JSZip Is Not Found

Clicking the Export to Excel button or calling the saveAsExcel throws an exception if the JSZip JavaScript library is not found.

Solution Include JSZip in the page. For more information on the export of the Grid to Excel, refer to this article.

Export Does Not Work in Internet Explorer and Safari

Internet Explorer versions below 10 and Safari cannot save a file and require the implementation of a server proxy.

Solution Set the ProxyURL option to specify the server proxy URL.

The following example demonstrates the user server proxy.

    public class ProxyController : Controller
    {
        [HttpPost]
        public ActionResult Save(string contentType, string base64, string fileName)
        {
            var fileContents = Convert.FromBase64String(base64);

            return File(fileContents, contentType, fileName);
        }
    }
    <%: Html.Kendo().Grid<MvcApplication.Models.ProductViewModel>()
        .Name("grid")
        .ToolBar(tools => tools.Excel())
        .Excel(excel => excel
            .AllPages(true)
            .ProxyURL(Url.Action("Save", "Proxy"))
        )
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("Products_Read", "Home"))
        )
    %>

    @(Html.Kendo().Grid<MvcApplication.Models.ProductViewModel>()
        .Name("grid")
        .ToolBar(tools => tools.Excel())
        .Excel(excel => excel
            .AllPages(true)
            .ProxyURL(Url.Action("Save", "Proxy"))
        )
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("Products_Read", "Home"))
        )
    )

See Also

In this article