Repost: output to xls works in firefox, not in IE

N

Ned Balzer

I have a puzzling problem. I am using some code I found in another
thread here to output the results of a gridview to excel. Here is the
subroutine:

Sub SendToExcel(ByVal Source As Object, ByVal E As EventArgs)
Dim gv As GridView =
Ctype(ColRep1Form.FindControl("xlsRep1GridView"),
GridView)
If gv.Rows.Count.ToString + 1 < 65536 Then
gv.AllowPaging = False
gv.AllowSorting = False
Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition",
"attachment;filename=dept1.xls")
Response.Charset = ""
EnableViewState = False
gv.visible= true
gv.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()
gv.DataBind()
End If
End Sub

This code works in firefox, or in IE when saving (not opening) the file
from the open/save dialogue. It doesn't work at all in IE when the
website is using https.(but it does work when using Firefox).

I would be grateful for any advice or explanation.

Thanks.

-- Ned
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top