J
John Walker
Hi,
I am using the following code to convert an asp.net 2.0 gridview to Excel.
When this happens the user will be prompted to either open the file, save it
to disk, cancel, etc., and it works fine but now there's a new requirement
whereby I'll need to have the gridview automatically saved as an Excel file
on the server's hard drive instead of being downloaded to the client browser.
Is there a way to accomplish that?
Dim resp As HttpResponse
resp = Page.Response
resp.ContentType = "application/download"
Page.EnableViewState = False
resp.Charset = String.Empty
resp.AppendHeader("Content-Disposition",
"attachment;filename=PerformanceRpt.xls")
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
gv.AllowPaging = False
gv.RenderControl(hw)
Thanks,
John
I am using the following code to convert an asp.net 2.0 gridview to Excel.
When this happens the user will be prompted to either open the file, save it
to disk, cancel, etc., and it works fine but now there's a new requirement
whereby I'll need to have the gridview automatically saved as an Excel file
on the server's hard drive instead of being downloaded to the client browser.
Is there a way to accomplish that?
Dim resp As HttpResponse
resp = Page.Response
resp.ContentType = "application/download"
Page.EnableViewState = False
resp.Charset = String.Empty
resp.AppendHeader("Content-Disposition",
"attachment;filename=PerformanceRpt.xls")
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
gv.AllowPaging = False
gv.RenderControl(hw)
Thanks,
John