Search results

Show Spinner on Grid when Exporting in ASP.NET Core Grid control

21 Oct 2021 / 1 minute to read

You can show/ hide spinner component while exporting the grid using showSpinner/ hideSpinner methods. You can use toolbarClick event to show spinner before exporting and hide a spinner in the pdfExportComplete or excelExportComplete event after the exporting.

In the toolbarClick event, based on the parameter as Grid_pdfexport or Grid_excelexport we can call the showSpinner method from grid instance.

In the pdfExportComplete or excelExportComplete events, We can call the hideSpinner method.

In the below demo, we have rendered the default spinner component when exporting the grid.

Copied to clipboard
<ejs-grid id="Grid" dataSource="@ViewBag.DataSource" allowPdfExport="true" allowExcelExport="true" toolbarClick="toolbarClick" pdfExportComplete="pdfExportComplete" excelExportComplete="excelExportComplete" toolbar="@(new List<string>() {"PdfExport", "ExcelExport"})" allowPaging="true">
        <e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" textAlign="Right" width="120"></e-grid-column>
        <e-grid-column field="CustomerID" headerText="Customer ID" visible="false" width="140"></e-grid-column>               
        <e-grid-column field="Freight" headerText="Freight" textAlign="Right" format="C2" width="120"></e-grid-column>
        <e-grid-column field="OrderDate" headerText="Order Date" width="140" format="yMd"></e-grid-column>

    function toolbarClick(args) {
        var gridObj = document.getElementById("Grid").ej2_instances[0];
        if ( === 'Grid_pdfexport') {
        else if ( === 'Grid_excelexport') {

    function pdfExportComplete(args) {
    function excelExportComplete(args) {
Copied to clipboard
public IActionResult Index()
    var Order = OrderDetails.GetAllRecords();
    ViewBag.DataSource = Order;
    return View();