0

Am using some code to export data from gridview. Suppose if I have small content it export the data perfectly. But the grid have some lage amount of data then it display the below message " exception of type 'system.outofmemoryexception' was thrown.". Please help me to fix this error. am not able to fix this...

This is my partial code :

      Sales_GridView.RenderControl(htw);//Error in this line
      Response.Write(sw.ToString());   
      Response.End();
TRR
  • 1,637
  • 2
  • 26
  • 43
Bharathi
  • 33
  • 3

1 Answers1

0

The Worksheet size 65,536 rows by 256 columns so check the row while exporting the data into excel

naval
  • 1,423
  • 1
  • 13
  • 26
  • But i export more than 1,00,000 records properly. – Bharathi Jun 18 '12 at 05:54
  • first of all you have to count how many sheet will be created that means divide 2,00,000/65,536=4 sheet will be created then after you have to write 65536 in one sheet and next rows will be added into next sheet the sheet will created dynamically.to create the dynamically sheet you will follow the following link http://stackoverflow.com/questions/193092/c-sharp-how-to-add-excel-worksheet-programatically-office-xp-2003 – naval Jun 18 '12 at 11:01