开发者

Error occured while export data from excel

I am getting an error while exporting data to an excel sheet.

Code

Response.Clear()
Response.AddHeader("content-disposition",   "attachment;filename=CompletionDatesReport.xls")
Response.Charset = ""
Response.Cache.SetCacheability开发者_StackOverflow中文版(HttpCacheability.NoCache)
Response.ContentType = "application/vnd.xls"
Dim stringWrite As StringWriter = New StringWriter()
Dim htmlWrite As HtmlTextWriter = New HtmlTextWriter(stringWrite)
gridData.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.End()

Error

Internet explorer cannot download abc.aspx from www.xyz.com.

Internet explorer was not able to open this internet site.The requested site is either unavailable or cannot be found.Please try again later.


Remove the line no 4

Response.Cache.SetCacheability(HttpCacheability.NoCache)

It will be work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜