Export Issue

Discussion in 'ASP .Net Web Controls' started by Gunawan, Jun 8, 2007.

  1. Gunawan

    Gunawan Guest

    Hi there,
    I am using this code that I have found in the internet to generate excel
    output.

    Response.Clear();
    Response.AddHeader("content-disposition",
    "attachment;filename=kirim.xls");
    Response.Charset = "";

    // If you want the option to open the Excel file without saving than
    // comment out the line below
    // Response.Cache.SetCacheability(HttpCacheability.NoCache);

    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    Response.ContentType = "application/vnd.xls";

    System.IO.StringWriter stringWrite = new System.IO.StringWriter();
    System.Web.UI.HtmlTextWriter htmlWrite =
    new HtmlTextWriter(stringWrite);

    //gv.RenderControl(htmlWrite);
    this.RenderControl(htmlWrite);

    Response.Write(stringWrite.ToString());
    Response.End();


    But I've got this error (Exception) bellow when Response.End() issue.
    "Unable to evaluate expression because the code is optimized or a native
    frame is on top of the call stack."

    How to correct this issue?

    Regards,
    Gun
     
    Gunawan, Jun 8, 2007
    #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. =?Utf-8?B?RGF2aWQgVmFsbGU=?=

    Invalid export DLL or export format

    =?Utf-8?B?RGF2aWQgVmFsbGU=?=, Oct 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    3,664
    =?Utf-8?B?RGF2aWQgVmFsbGU=?=
    Oct 29, 2003
  2. Arvind R

    Export to Excel issue (C#)

    Arvind R, Jan 24, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    16,520
    =?Utf-8?B?YnJpYW5wbWNjdWxsb3VnaA==?=
    Feb 24, 2006
  3. =?Utf-8?B?ZGlub28=?=

    Urgent - Asp.NET Datagrid export Excel - landscape Issue

    =?Utf-8?B?ZGlub28=?=, Aug 7, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    2,796
    =?Utf-8?B?ZGlub28=?=
    Aug 7, 2006
  4. =?Utf-8?B?TmVv?=

    export to excel issue

    =?Utf-8?B?TmVv?=, Oct 8, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    342
    =?Utf-8?B?TmVv?=
    Oct 9, 2006
  5. Maarten Porters
    Replies:
    1
    Views:
    462
    Florian Gilcher
    Jul 28, 2008
Loading...

Share This Page