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

[Solved] ExportToExcel() doesn't return all data.

3 Answers 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brandon Camarillo
Top achievements
Rank 1
Brandon Camarillo asked on 27 Oct 2009, 10:25 PM
Good evening,

I am having a challenge with getting the ExportToExcel() to return all the data in my grid to excel.  It works fine in the sense that it grabs the current page of data for download, but that is it. It doesn't bring down everything even by setting the properties as outlined in the Telerik documentation: 

The background:
-The grid is populated via AJAX using the RadAjaxManager.
-The properties are set in this method:

 

public void ConfigureExport()

 

{

radgridActive.ExportSettings.ExportOnlyData =

true;

 

radgridActive.ExportSettings.IgnorePaging =

true;

 

 

this.radgridActive.ExportSettings.FileName = "ActiveReport";

 

}

I even went as far as reading this thread and following this example:  http://www.telerik.com/help/aspnet-ajax/grdexportwithajax.html
Here is a sample of the code I used to follow this example.

 

<

 

telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

 

 

 

 

 

 

<script type="text/javascript">

 

 

function mngRequestStarted(ajaxManager, eventArgs)

 

{

 

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

 

eventArgs.set_enableAjax(

false);

 

}

 

 

</script>

 

 

</telerik:RadCodeBlock>

........

 

<

 

telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" ClientEvents-OnRequestStart="mngRequestStarted">
.....
Where "btnExport" is the control that initiates the Export.
No Luck Here either.  I am at a loss where to go from here. I'd be happy to supply any information to you that you may need further.

Thank you.

 

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Oct 2009, 10:27 AM
Hi Brandon ,

When you set the ExportOnlyData property of the grid to True it will not export columns such as
GridButtonColumn/GridTemplateColumn/GridHyperLinkColumn as they are not considered as data. You can check out the links below to know more on how to exports such columns .

http://www.telerik.com/help/aspnet-ajax/grdexporttipstricks.html
http://www.telerik.com/community/code-library/aspnet-ajax/general/export-radgrid-content-to-excel-word-csv-pdf-with-ajax-enabled.aspx

Thanks,
Princy
0
Brandon Camarillo
Top achievements
Rank 1
answered on 28 Oct 2009, 04:51 PM
I don't think you are following what I am saying.  I am not trying to export any of these types of columns.  I am just trying to export ALL the data to Excel from the Grid (only current page of data currently exports).  Nothing in the Telerik documentation is helpful to me in the sesnse that is shows me a working soluttion how to get this working.
0
Brandon Camarillo
Top achievements
Rank 1
answered on 28 Oct 2009, 05:22 PM
Update:

I finally got this thing to work.  All I did was re-bind the grid in the line of code right before I called the export function. This seemed to work for now at least.

BindRadGrid();

radgridActive.MasterTableView.ExportToExcel();

I couldnt find this suggestion in the documenation so hopefully if someone has this same issue, this post will be helpful.

Thanks.

Tags
Grid
Asked by
Brandon Camarillo
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Brandon Camarillo
Top achievements
Rank 1
Share this question
or