This is a migrated thread and some comments may be shown as answers.

How to call Export Excel externally grid

2 Answers 665 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dario
Top achievements
Rank 1
Veteran
Dario asked on 05 May 2020, 08:53 PM

Hi to all, I would create a view to show several custom functions before grid, these functions will generate several effect to loading data into a grid.

But I would also a Export Excel button, but not above the grid, but enternally, into a div group that contains other controls.

How can I do this?

I don't want use ToolBar of grid.

Can i call a javascript code for example $("#myGrid").exportExcel(); ? Is it possibile?

2 Answers, 1 is accepted

Sort by
0
Accepted
Anton Mironov
Telerik team
answered on 07 May 2020, 03:48 PM

Hi Dario,

The Telerik UI Grid for ASP.NET Core can be programmatically exported via the excelExport() method. More information could be found in the article below:

https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/events/excelexport

Within the click event handler of a button obtain an instance of the Telerik UI Grid and export it programmatically. Here is an example:

@(Html.Kendo().Button()
        .Name("primaryTextButton")
        .HtmlAttributes( new {type = "button", @class = "k-primary" } )
        .Content("Export Grid")
        .Events(e => e.Click("exportGrid")))

Function for the Excel export:

function exportGrid() {
            var grid = $("#Grid").data("kendoGrid");
            grid.saveAsExcel()
        }

 

I hope this information helps. I will be glad to assist you further. 

Regards,
Anton Mironov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Dario
Top achievements
Rank 1
Veteran
answered on 08 May 2020, 07:11 AM
Perfect! Thank you.
Tags
Grid
Asked by
Dario
Top achievements
Rank 1
Veteran
Answers by
Anton Mironov
Telerik team
Dario
Top achievements
Rank 1
Veteran
Share this question
or