Export to Excel with .NET Connector and generate.ashx no go

I have been struggling with this for a while now. I have a paged grid, so instead of exporting directly, I create a temporary grid, setting header, filter and sorting the same way as the real grid, grabbing the data through a .NET connector. The data seem to be loaded okay, I have the right number of columns and right number of rows when I get the onXLE event, and the XML is well formed, I tested it on one of the online validators. After that I call

myGrid.toExcel("http://localhost/Utility/Handlers/Generate.ashx"); 

Problem is the returning stream is only 588 bytes long… I tried using

http://dhtmlxgrid.appspot.com/export/excel

instead, I don’t even get a returning file from that address. I can call that address using my original grid with 50 rows and it creates a file ok. The data only have 583 rows, so it is not an extremely large file.

Should the code somehow be waiting for the file to be generated, if so how to do that?

The handler looks like this:

<%@ WebHandler Language="C#" CodeBehind="Generate.ashx.cs" Class="Utility.Handlers.Generator" %>

using System.Web;
using DHTMLX.Export.Excel;

namespace Utility.Handlers
{

    public class Generator : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            var writer = new ExcelWriter();
            context.Response.ContentType = writer.ContentType;
            context.Response.HeaderEncoding = System.Text.Encoding.UTF8;
            context.Response.AppendHeader("Content-Disposition", "attachment;filename=grid.xlsx");
            context.Response.AppendHeader("Cache-Control", "max-age=0");
            var xml = context.Request.Form["grid_xml"];
            xml = context.Server.UrlDecode(xml);
            var stream = writer.Generate(xml);
            stream.WriteTo(context.Response.OutputStream);

            context.Response.End();            
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}

Hello, Problem is the returning stream is only 588 bytes long... It seems to be something wrong with the serialized data sent to the export tool.
Can you attach an example of xml data that is returned from context.Server.UrlDecode(xml)?
You can also try the latest build of the export library to see if there any difference
s3.amazonaws.com/uploads.hipcha … 130214.zip

Here is a file with the resulting xml from UrlDecode. I believe I am already running with the latest code.
ContextUrlDecode.zip (23.2 KB)

Hi,
serialized columns have invalid widths, that must be a cause of the issue.
Can you post grid configuration code?

                var stest = "";
                var ftest = "";
                var ctest = "";
                for (nColumn = 0; nColumn < oGridProps.GridObject.getColumnsNum(); nColumn++) {
                    sColumnID = oGridProps.GridObject.getColumnId(nColumn);
                    stest += sColumnID ;
                    ftest += "#text_filter";
                    ctest += "str";
                    if (nColumn < (oGridProps.GridObject.getColumnsNum() - 1)) {
                        stest += ",";
                        ftest += ",";
                        ctest += ",";
                    }
                 }

                myGrid.setHeader(stest);
                myGrid.attachHeader(ftest);
                myGrid.setColSorting(ctest);
                myGrid.setSkin(SKIN_NAME);
                myGrid.setInitWidths("10,*");
                myGrid.attachEvent("onXLE", function (grid_obj, count) {
                    var nCol = myGrid.getColumnCount();
                    var nRow = myGrid.getRowsNum();
                    var sURL = "http://localhost//Areas/Utility/Handlers/Generate.ashx";
                    myGrid.toExcel(sURL);
                });
                myGrid.init();
                sMyURL = "http://localhost/Areas/Utility/Handlers/ExportConnector.ashx?DatabaseID=1&Table=Table1";
                myGrid.load(sMyURL);