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

Discussion in 'ASP .Net' started by Ned Balzer, Dec 13, 2006.

  1. Ned Balzer

    Ned Balzer Guest

    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
     
    Ned Balzer, Dec 13, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SS

    output to *.xls

    SS, Feb 5, 2004, in forum: C Programming
    Replies:
    7
    Views:
    433
  2. F. GEIGER
    Replies:
    3
    Views:
    813
    F. GEIGER
    Aug 6, 2004
  3. vasudevram
    Replies:
    0
    Views:
    371
    vasudevram
    Oct 27, 2006
  4. Ashok Prabhu

    Repost: Read a running process output

    Ashok Prabhu, Feb 5, 2010, in forum: Python
    Replies:
    7
    Views:
    543
    Nobody
    Feb 5, 2010
  5. Sonnich

    Can output as HTML but not as XLS

    Sonnich, Jul 31, 2006, in forum: ASP General
    Replies:
    0
    Views:
    114
    Sonnich
    Jul 31, 2006
Loading...

Share This Page