Posted on: 7/16/2013 10:53:17 PM | Views : 257

Hello, I'm using the following code to export the contents of a gridview to excel.  Actually, I save three gridviews to file then zip them up for the user to save to their computer.
 
I do get the excel file saved and my zip of the five excel files works; however, the data in the excel files is duplicated. For example if the gridview  had one row the excel file will have two rows of that same gridview row.
 
What to do? Does it have something to do with response?
 example of creating excel file
Dim sw As New System.IO.StringWriter() Dim htw As New System.Web.UI.HtmlTextWriter(sw) ' Render grid view control. gvExportSurveyDetails.RenderControl(htw) ' Write the rendered content to a file. Dim renderedGridView As String = sw.ToString() File.WriteAllText(Server.MapPath(ExportSurveyDetailsFileName), renderedGrid ...

Go to the complete details ...