
-----------------------------------
asteffes
Fri Jul 07, 2006 7:45 am

Error outputting DataGrid to Excel File
-----------------------------------
I am using the code located below to output my datagrid to an excel file. 

Everything worked great yesterday, but today there is a problem when you select 'Open' from the "Open, Save, or Cancel" dialogue for the XLS file.

The error looks something like:
"C:\....Temporary Internet Files\....\TimeReport
  

Response.Clear()
        Response.AddHeader("content-disposition", "attachment;filename=TimeReport.xls")
        Response.Charset = ""
        Response.Cache.SetCacheability(HttpCacheability.NoCache)
        Response.ContentType = "application/vnd.xls"
        Dim stringWrite = New System.IO.StringWriter
        Dim htmlWrite = New HtmlTextWriter(stringWrite)

        dataGrid.RenderControl(htmlWrite)
        Response.Write(stringWrite.ToString())
        Response.End()


