How to download all records from Datagrid to Excel file
How to download all records from Datagrid to Excel file
Hi
I am trying to download all the records that are available in datagrid to Excel/CSV file.
Problem for me was it is only exporting the records that are showing on the screen but not all the recordset.
Also I was wondering if we apply filters on the data can we just download that dataset also?
I know there are plugins that help a bit with some of the printing, but seriously, I think the best way is to let the server handle this.
For me, I simply send back to the server the same request I made to get the records, but add an extra param for "switching" to excel mode. My server-side code will then process the query just as it normally would, but then it will create the excel file and push it for download.
The reason I like this is because it is simple, and it allows me as much freedom as I want to manipulate the data server-side before creating the Excel.