我有以下代码。它创建并保存了一个包含 grdview4 内容的 excel 文件,这很棒。但是在应用程序结束时,它会显示一个我不想要的对话框。有没有办法让对话框不显示?
Response.ContentEncoding = System.Text.Encoding.Unicode
Response.ContentType = "application/vnd.ms-excel"
' Response.AddHeader("content-disposition", "attachment;filename=""C:\EchoBACs\RejectedBACSBACs\rejectedBacs" & NewDate & ".xls")
' Response.TransmitFile("C:\rejectedBacs" & NewDate & ".xls")
Response.Charset = ""
Me.EnableViewState = False
Dim oStringWriter As New System.IO.StringWriter
Dim oHtmlTextWriter As New System.Web.UI.HtmlTextWriter(oStringWriter)
GridView4.HeaderRow.Style.Add("background-color", "#FFFFFF")
GridView4.RenderControl(oHtmlTextWriter)
Dim helpme As String = oStringWriter.ToString()
' Response.Write(oStringWriter.ToString())
' HttpContext.Current.Response.End()
File.WriteAllText("C:\EchoBACs\RejectedBACS\rejectedBacs" & NewDate & ".xls", helpme)
oHtmlTextWriter.Close()