ericbonsu
June 11th, 2008, 09:30 AM
I use the function below to export a datagrid to excel but the some of the data exported to excel is missing can anyone help?
I havew already looked into timeout issues but it can't be that becuase the missing data is random.
Sub DataGridToExcel(ByVal dgExport As DataGrid, ByVal response As HttpResponse)
dgExport.ShowHeader = True
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls")
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Dim stringWrite As New System.IO.StringWriter()
Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite)
dgExport.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.End()
End Sub
I havew already looked into timeout issues but it can't be that becuase the missing data is random.
Sub DataGridToExcel(ByVal dgExport As DataGrid, ByVal response As HttpResponse)
dgExport.ShowHeader = True
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls")
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Dim stringWrite As New System.IO.StringWriter()
Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite)
dgExport.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.End()
End Sub