Search articles in this blog and in my other related blogs.


Saturday, June 7, 2008

export gridview data to excel

step 1: clear httpcontext's reponse.
step 2: define content header of httpcontext response object.
step 3: set the response type to application/ms-excel
step 4: create a html table and set its gridlines to gridview gridlines
step 5: convert table row and gridview controls are replaced by literals in table.
step 6: render the table into the htmlwriter
step 7: render the htmlwriter into the response

source: http://mattberseth.com/blog/2007/04/export_gridview_to_excel_1.html

0 comments: