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

RadGrid.MasterTableView.ExportToExcel() not allowing label to be updated

2 Answers 101 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Emily
Top achievements
Rank 1
Emily asked on 27 Mar 2013, 05:32 PM
I have an export button that when clicked, retrieves the date set in two RadDatePickers and then exports the results of all incidents between those two dates. I also have a label that is empty if the export is successful or will display "Error: Query too large to export" if the query is too large to export to excel (this is all in a try/catch statement).  

I have 2 issues. The first is concerning the error. The label was not being updated so I placed the label change in the try statement before the ExportToExcel method just to see if it was working. If I comment out the RadGrid.MasterTableView.ExportToExcel() line, it works perfectly. However, with this line, it won't work. By won't work, I mean the export works perfectly fine but the label is never updated. Also the try/catch statement does not work at all and I wonder if that is due to the same problem.

The second issue, is that ExportToExcel() used to export to Excel 2003 while ExportToExcel2007() obviously used to export to Excel 2007. Now, ExportToExcel2007() is deprecated. Limiting the query is not an option for our system. Is there a way to export to Excel 2007? I tried using ExportToExcel() in hopes that since the two methods were combined, it would export to the latest version but it is still exporting to 2003 with a .xls extension.

If someone could help solve these two problems that would be extremely helpful!
Thanks in advance!
Emily

Update:
On further inspection of the first issue, I have found the following code in a javascript file:

function

 

pnlRequestStarted(ajaxPanel, eventArgs)

 

{

 

    if(eventArgs.EventTarget.indexOf("btnExport") != -1)

 

    {

        eventArgs.EnableAjax =

false;

 

    }

 

 

}

The problem is, I need to set this back to true I believe in order to update the label and allow the try/catch statement to function properly. Any ideas? Thanks!

2 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 01 Apr 2013, 12:40 PM
Hello Emily,

I am afraid what you are trying to achieve is not possible. The reason is that when you call Export method none of the made changes will be persisted on the client.
As to the ExportToExcel2007 method - it does almost the same as ExportToExcel, so we decided to merge both methods and to mark the ExportToExcel2007 method as deprecated. Note that it was part of our former ASP.NET suite - RadControls for ASP.NET (also known as "Classic"). This method is not available in RadControls for ASP.NET AJAX. I would suggest you to use Biff Export which supports all versions of Microsoft Excel, starting from 2003.

Regards,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Emily
Top achievements
Rank 1
answered on 02 Apr 2013, 03:13 PM
Thank you for the reply! I will try the BIFF Export approach. I found a way to work around the issue with updating client side.

Thanks again!
Emily
Tags
Grid
Asked by
Emily
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Emily
Top achievements
Rank 1
Share this question
or