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

Export to Excel - Thank you!

9 Answers 345 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bryan
Top achievements
Rank 1
Bryan asked on 13 Feb 2015, 06:14 PM
I've just finished implementing the Export to Excel functionality from v2014.3.1411 in apps for two different clients. I held off until now because the first version of the functionality, while great, was unusable to me because if the grid had more than one page of data, the export only exported the current page. The latest version with AllPages functionality fully implemented is perfect. It completely meets my clients' needs for ad hoc reporting. Thank you so much and my compliments to the developers involved.

9 Answers, 1 is accepted

Sort by
0
Bob
Top achievements
Rank 2
answered on 16 Feb 2015, 10:42 PM
Hi Bryan,
I have the same problem with the Grid that you indicate was solved. I did install the 2014.3.1411 version but still, I only get the first page of data.

My setup looks like this: Is this what you are using?
<div class="col-md-12">
    @(Html.Kendo().Grid(Model.Summaries)
            .Name("SummaryGrid")
            .Columns(columns =>
            {
                columns.Bound(p => p.FirstName).Title("First name").Width(120).Locked();
                columns.Bound(p => p.LastName).Title("Last Name").Width(130).Locked();
                columns.Bound(p => p.Email).Title("Email").Width("15em");
                columns.Bound(p => p.RaceType).Width("10em");
                columns.Bound(p => p.Amount).Title("Donation").Width("8em");
                columns.Bound(p => p.Gender).Title("Gender").Width("8em").Format("{0:MM/dd/yyyy}");
                columns.Bound(p => p.Street).Title("Street").Width("15em");
                columns.Bound(p => p.City).Title("City").Width("10em");
                columns.Bound(p => p.Zip).Title("Zip").Width("6em");
                columns.Bound(p => p.Phone).Title("Phone").Width("8em");
                columns.Bound(p => p.BibNumber).Title("Bib").Width("8em");
                 
            })
            .ToolBar(tools => tools.Excel())
            .Groupable()
            .Pageable(pager => pager
                .Input(true)
                .Numeric(true)
                .Info(true)
                .PreviousNext(true)
                .Refresh(true)
                .PageSizes(true)
                .PageSizes(new int[] { 10, 50, 500 })
                )
 
            .Sortable()
            .Scrollable()
            .Filterable()
            .Events(e => e.DataBound("onDataBound3"))
            .DataSource(dataSource => dataSource
                .Ajax()
                .Read(read => read.Action("Summaries_Read", "Reports"))
                .PageSize(10)
 
            )
            .Excel(excel => excel
                .FileName("Race Summaries Export.xlsx")
                .Filterable(true)
                .AllPages(true)
                .ProxyURL(Url.Action("Excel_Export_Summaries_Save", "Reports"))
            )
            .Reorderable(r => r.Columns(true))
            .Resizable(r => r.Columns(true))
            .ColumnMenu()
    )
</div>

I have to rely on my own custom code to export to Excel and really want to get away from it and use the Telerik - but it just isn't working for me.
Thanks,
Bob
0
Bryan
Top achievements
Rank 1
answered on 17 Feb 2015, 12:48 AM
Hi Bob,

The Excel setting look like mine except I'm not setting the ProxyURL. I'm doing all my sorting, filtering, and grouping on the server so I can take advantage of SQL Server's native capabilites. Also, did you update your project's version of Telerik's stuff after you updated your install? It's now working for me on two different projects.

Thanks,
-Bryan
0
Bob
Top achievements
Rank 2
answered on 17 Feb 2015, 02:51 AM
Hi Bryan,
Yes, I updated my Kendo.Mvc.dll reference and it now points to C:\Telerik\UI for ASP.NET MVC 2014.3 1411\wrappers\aspnetmvc\Binaries\Mvc5\Kendo.Mvc.dll

I had tried with and without setting the ProxyURL.

I will try removing the sorting, filtering and grouping - although, I was hoping to use it. I'll report back in a few...
0
Bob
Top achievements
Rank 2
answered on 17 Feb 2015, 03:23 AM
I tried removing the filtering, sorting, and everything all except for paging and it just never works. 

Perhaps I need to pull my project out of source control, delete the Telerik folders and try it again.

I've checked to make sure that I'm pulling in the right version using Telerik JustDecompile and it shows that I'm using 2014.3.1411.545

I've spot checked a number of the js files and they are also the correct version.

I updated my BundleConfig.cs and I updated my Content/kendo and my Scripts/kendo. I usually copy the js and style folder from the release area of kendo into folders with the version number and then point my BundleConfig.cs to those new folders. 

I guess I may have to create a small test app and send it in. I saw that you were successful so I had high hopes.

Thanks,
Bob






0
Bryan
Top achievements
Rank 1
answered on 17 Feb 2015, 07:46 AM
Hi Bob,

I was going to ask if you had updated scripts and content as well as the DLL. The project updater from Telerik stopped working for me a couple of versions ago so I've been doing manual project updates. It's easy to forget a step since there aren't any good instructions on doing it. The next time I have to do it, I'm going to have one of my more junior colleagues observe and write up a set of instructions. I'm sorry you're not having any luck getting the multipage Excel export working. The only thing I see that you're doing that I'm not is all the parameters you're feeding into the Pageable extension method. I honestly was unaware of them and I'm going to give the PageSizes one a try tomorrow. If my Excel export stops working I'll let you know.

Good luck,
-Bryan
0
Bryan
Top achievements
Rank 1
answered on 17 Feb 2015, 07:57 AM
Hey Bob,

One other thought I had. After you updated and rebuilt, did you clear your browser's cache? I had a column resizing issue that required an update and it still didn't work until I did a Ctrl+F5. Just a thought.

-Bryan
0
Bob
Top achievements
Rank 2
answered on 17 Feb 2015, 10:48 PM
Hi Bryan,
Yes, I tried both of your last suggestions - in fact I even created a whole new app on another computer but still get the same results. I actually sent the issue to the telerik support and I got this answer. I'm wondering if you know what he means? I am lost...

Hello Bob,The Excel export is designed to work only with Ajax bound Grid and does not support the current mixed implementation - server model + ajax transport. I would suggest to remove the server population of the Grid and leave only the transport read configuration. 
E.g.
@(Html.Kendo().Grid<Lemon.Db.Models.PayPal>()
    .Name("PayPalGrid")
    ...
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("PayPals_Read", "GridTest"))
    )
)

Dimiter Madjarov 
Telerik 
0
Bob
Top achievements
Rank 2
answered on 18 Feb 2015, 12:01 PM
I completely missed the given answer - my bad! The Telerik (Dimiter) guy, had shown me the answer but I missed it. Instead of using the passed in the data from the controller to the view where I used @(Html.Kendo().Grid(Model) I just had to use @(Html.Kendo().Grid<Lemon.Db.Models.PayPal>() and that works perfectly. So simple...
0
Jolene
Top achievements
Rank 1
answered on 27 Feb 2015, 06:47 PM
Thank you.  I was having this same problem and had the mixed server model + ajax transport as well.  It is working now.  
Tags
Grid
Asked by
Bryan
Top achievements
Rank 1
Answers by
Bob
Top achievements
Rank 2
Bryan
Top achievements
Rank 1
Jolene
Top achievements
Rank 1
Share this question
or