I need to export data from grid without actually displaying the grid. When I drop grid on a aspx form, set datasource with stored procedure, one parameter linked to a drop box selected value, set some properties like export all pages, only data and then fire export to excel if I have grid visible property set to true it generates excel file with field names as headers. If I have grid visible property set to false excel file still generated but no field names added as column headers. Is it a correct behavior for the grid? I use 2013 Q3 version of Ajax .Net controls, VS2010, IE 9, Chrome. THanks!
Hi Milena, I had it implemented in a similar fashion last year and it's working as desired. My question was about missing headers and if it was possible to include them during export to Excel from hidden grid (everything else worked just fine) without additional processing on the page (and coding on my part). I understand if it's not possible or you don't want/have time to implement it as a part of regular functionality for the grid. Thank you.
You can achieve the desired behavior as use the following code: protected void Unnamed_Click(object sender, EventArgs e) { RadGrid1.Visible = true; RadGrid1.Rebind(); RadGrid1.MasterTableView.ExportToExcel(); } Note, using this approach RadGrid will not be visible in browser.