How to call Export Excel externally grid

3 posts, 1 answers
  1. Dario
    Dario avatar
    40 posts
    Member since:
    Jun 2018

    Posted 05 May 2020 Link to this post

    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. Answer
    Anton Mironov
    Admin
    Anton Mironov avatar
    168 posts

    Posted 07 May 2020 Link to this post

    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.
  3. Dario
    Dario avatar
    40 posts
    Member since:
    Jun 2018

    Posted 08 May 2020 in reply to Anton Mironov Link to this post

    Perfect! Thank you.
Back to Top