468,140 Members | 1,435 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,140 developers. It's quick & easy.

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

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

Dec 14 '06 #1
0 796

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by pdc | last post: by
6 posts views Thread by Alec MacLean | last post: by
3 posts views Thread by =?Utf-8?B?R2F1cmF2?= | last post: by
9 posts views Thread by jodleren | last post: by
4 posts views Thread by Michael Starberg | last post: by
27 posts views Thread by didacticone | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.