EXT.NET 3.0.0 RELEASED!
Now with Tablet Support!
Ext.NET 3.0.0 is here with lots of new cool features and now with tablet support! Check Examples Explorer now to see it in action or download and test it yourself for free!
Results 1 to 3 of 3

Thread: Exporting gridpanel content to excel

  1. #1
    Member
    Join Date
    Dec 2011
    Posts
    6

    Exporting gridpanel content to excel

    Hello,

    I've been struggling for hours trying to find a solution to this problem that i've come across :S, i have to export the content of a gridpanel to a excel file,
    this is supposed to be the function that does it :

    Code:
    void exportarExcel()
        {
            string attachment = "attachment; filename=Export.xls";
            Response.ClearContent();
            Response.AddHeader("content-disposition", attachment);
            Response.ContentType = "application/ms-excel";
            System.IO.StringWriter sw = new System.IO.StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            gridRegistroInserciones.RenderControl(htw);
            Response.Write(sw.ToString());
            Response.End();    
        }
    Then i got to my web form and run the app, when i click the button that exports to excel all i get is this error

    http://imageshack.us/photo/my-images/844/capturavb.png/

    in case the image cannot be seen the error is this:

    Code:
    Status Code: 200
    Status Text: BAD RESPONSE: Unexpected Token <
    Please help! :(
    Last edited by geoffrey.mcgill; Dec 13, 2011 at 9:48 PM. Reason: please use [CODE] tags

  2. #2
    Member plykkegaard's Avatar
    Join Date
    Feb 2009
    Location
    Denmark
    Posts
    343
    I assume you want the enduser to download an excel spreadsheet?

    Have a look a this sample
    http://examples1.ext.net/Examples/Gr...ort_Data_Ajax/

    Better yet is to call an httphandler

    rgds /Peter

  3. #3
    Member
    Join Date
    Dec 2011
    Posts
    6
    It worked out perfectly :D thx

Similar Threads

  1. Exporting Grid Data for Excel, CSV, XML, HTML, PDF [EXAMPLE Codes]
    By fatihunal in forum Examples and Extras
    Replies: 5
    Last Post: Sep 04, 2012, 11:41 PM
  2. [CLOSED] hide a field while exporting data to Excel
    By Fahd in forum 1.x Premium Help
    Replies: 4
    Last Post: Jun 20, 2012, 5:46 PM
  3. exporting to excel with gridfilters on
    By norphos in forum 1.x Help
    Replies: 0
    Last Post: Oct 18, 2011, 2:14 PM
  4. Replies: 0
    Last Post: Sep 05, 2011, 11:01 AM
  5. [CLOSED] Excel exporting issue
    By Pablo_Azevedo in forum 1.x Premium Help
    Replies: 9
    Last Post: Oct 20, 2010, 6:12 PM

Tags for this Thread

Posting Permissions