Excel exporting. Nothing happens

I am using version 26.2.7 in my Blazor server app (.NET 7) and I am trying to use the export to excel functionality based on the technical documentation. I am using a trial license. 


But when I click the export button nothing happens...  Any ideas what the problem might be? 


Sample code: 

@page "/fetchdata"

@using Syncfusion.Blazor.Grids;



<SfGrid ID="Grid" @ref="DefaultGrid" DataSource="@Orders" AllowSorting="true" Toolbar="@(new List<string>() { "ExcelExport" })" AllowExcelExport="true" AllowPaging="true">

    <GridEvents OnToolbarClick="ToolbarClickHandler" TValue="Order"></GridEvents>

    <GridColumns>

        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>

        <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn>

        <GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn>

        <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn>

    </GridColumns>

</SfGrid>


@code {

    private SfGrid<Order> DefaultGrid;


    public List<Order> Orders { get; set; }


    public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args)

    {

        if (args.Item.Id == "Grid_excelexport") //Id is combination of Grid's ID and itemname

        {

            await this.DefaultGrid.ExcelExport();

        }

    }


    protected override void OnInitialized()

    {

        Orders = Enumerable.Range(1, 75).Select(x => new Order()

            {

                OrderID = 1000 + x,

                CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],

                Freight = 2.1 * x,

                OrderDate = DateTime.Now.AddDays(-x),

            }).ToList();

    }


    public class Order

    {

        public int? OrderID { get; set; }

        public string CustomerID { get; set; }

        public DateTime? OrderDate { get; set; }

        public double? Freight { get; set; }

    }

}


2 Replies

KD Kristian Dean Munkholm August 5, 2024 09:27 AM UTC

I have found the problem. It was related to wrong javascript reference... 



PS Prathap Senthil Syncfusion Team August 6, 2024 11:58 AM UTC

Hi Kristian Dean Munkholm,

Thanks for the update,

We are happy to hear that the reported issue has been resolved on your end. We will now be closing this thread.


Regards,
Prathap Senthil


Loader.
Up arrow icon