0
votes

I'm tryin to export kendo grid to excel: i tried this method:

http://jsfiddle.net/SZBrt/4/

But i have a kendo grid already that gets data on button click. I want another button to excel the grid with datas on export button click as mentioned in jsfiddle.

@(Html.Kendo().Grid<KendoGridExportExcelMvc.Models.Sales>()
    .Name("Sale")
    .Columns(columns =>
    {

        columns.Bound(p => p.R).Width(100);
        columns.Bound(p => p.Cur).Width(100);
        columns.Bound(p => p.goods).Width(100);
        columns.Bound(p => p.cost).Width(70);
        columns.Bound(p => p.isdeleted).Width(60);


    })
    .Sortable()
   .Scrollable()
    .HtmlAttributes(new { @style = "Font:12px calibri; " })
    .Filterable()


        )

how to bring this inside the js file. please help,

1

1 Answers

0
votes

Well, dude, you are just rendering HTML.

If you want to generate a real CSV file, just use one of the classes from the System.IO namespace, and write directly to the Response's OutputStream.

See this article for reference on how to do it: Writing to Output Stream from Action