Hi,
I'm trying to use the Export to Excel functionality, provided by the RadGrid, in conjunction with the MVC framework. (Please ignore this thread if already asked, but every thread pops up when searching for MVC due to the menu bar).
Since it's MVC, the grid is only known by the view. I've tried something in the line of:
<% |
grdReport.DataSource = ViewData["Report"]; |
grdReport.DataBind(); |
grdReport.ExportSettings.ExportOnlyData = false; |
grdReport.ExportSettings.IgnorePaging = true; |
grdReport.ExportSettings.OpenInNewWindow = true; |
grdReport.MasterTableView.ExportToExcel(); |
%> |
But it only displays the grid, not exporting it. My guess is that at this point, the view is already being rendered, being it too late to change the headers, etc...
Is there a preferred way to export to Excel using MVC? If not, is there a way to export strictly programmatically and catch the export stream, instead of streaming it directly to the response?
Kind regards,
Dries