gridview does not get exported to explorer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • imranabdulaziz
    New Member
    • Dec 2006
    • 29

    gridview does not get exported to explorer

    Dear all,

    i am using asp.net ,C# , Microsoft internet explorer 6 version ans iis5.0.

    My problem is gridview data does not get exported in explorer whereas when i select firefox it exported to excel.
    i change the internet security setting to low and added the site to trusted sites .

    what could be the reason.

    please help.

    code to export is

    Response.Clear( );

    Response.AddHea der("content-disposition", "attachmentfile name=FileName.x ls");

    Response.Charse t = "";

    // If you want the option to open the Excel file without saving than

    // comment out the line below

    Response.Cache. SetCacheability (HttpCacheabili ty.NoCache);

    Response.Conten tType = "applicatio n/vnd.xls";

    System.IO.Strin gWriter stringWrite = new System.IO.Strin gWriter();

    System.Web.UI.H tmlTextWriter htmlWrite = new HtmlTextWriter( stringWrite);

    GridView1.Rende rControl(htmlWr ite);

    Response.Write( stringWrite.ToS tring());

    Response.End();



    please guide me.



    thanks
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    What happens in IE when you do this?
    Do you get errors?
    I have this working just fine.

    Edit: OH! You shouldn't be using a STRINGwriter for binary data, it will get scrambled.

    Comment

    Working...