Author Topic: Error 500 when invoking pqGrid("exportExcel"...  (Read 2738 times)

inafking

  • Newbie
  • *
  • Posts: 10
    • View Profile
Error 500 when invoking pqGrid("exportExcel"...
« on: January 15, 2016, 08:48:51 pm »
Hi, I've been struggling trying to solve a problem when implementing the Excel export button as shown in the paramquery grid examples. The code I've is the following:
Code: [Select]
    $(function () {

        var colModel = [
            { title: "ID Registro", dataIndx: "IdRegistro", width: 100 },
            { title: "Categoria", width: 180, dataIndx: "GlsSiglaCategoria" },
            { title: "Valor", width: 140, dataIndx: "GlsValor" }
];
        var dataModel = {
            recIndx: "IdRegistro",
            location: "remote",
            sorting: "local",           
            dataType: "JSON",
            method: "GET",
            sortIndx: "GlsSiglaCategoria",
            sortDir: "up",
            url: "json/GeneralTiposJson.aspx"
            , getData: function (dataJSON) {
                return { data: dataJSON };
            }
        }
        var newObj = {
            flexHeight: true,
            flexWidth: true,
            dataModel: dataModel,
            showTitle: false,           
            showBottom: true,           
            toolbar: {
                //cls: 'pq-toolbar-export',
                items: [{
                        type: 'button',
                        label: "Export to Excel",
                        icon: 'ui-icon-document',
                        listeners: [{
                            "click": function (evt) {
                                $("#grid_export").pqGrid("exportExcel", { url: "json/crud/GrillaCRUDJson.aspx", sheetName: "pqGrid sheet" });
                            }
                        }]
                }]
            },
            pageModel: {type:'local'},
            colModel: colModel,
            selectionModel: { mode: 'single' },
            editable: true,
            scrollModel: { horizontal: false },
            title: "Contact Details"
        };
        var $grid = $("#grid_export").pqGrid(newObj);
    });

This is the json data:
Code: [Select]
[{"IdRegistro":1,"GlsSiglaCategoria":"Tipo Dato Parametro","GlsValor":"Entero 32 bits"},{"IdRegistro":2,"GlsSiglaCategoria":"Tipo Dato Parametro","GlsValor":"Entero 64 bits"},{"IdRegistro":3,"GlsSiglaCategoria":"Tipo Dato Parametro","GlsValor":"Texto"},{"IdRegistro":4,"GlsSiglaCategoria":"Tipo Dato Parametro","GlsValor":"Decimal"},{"IdRegistro":5,"GlsSiglaCategoria":"Tipo Dato Parametro","GlsValor":"Fecha"},{"IdRegistro":6,"GlsSiglaCategoria":"Tipo Dato Columna Grilla","GlsValor":"Entero 32 bits"},{"IdRegistro":7,"GlsSiglaCategoria":"Tipo Dato Columna Grilla","GlsValor":"Entero 64 bits"},{"IdRegistro":8,"GlsSiglaCategoria":"Tipo Dato Columna Grilla","GlsValor":"Texto"},{"IdRegistro":9,"GlsSiglaCategoria":"Tipo Dato Columna Grilla","GlsValor":"Decimal"},{"IdRegistro":10,"GlsSiglaCategoria":"Tipo Dato Columna Grilla","GlsValor":"Fecha"},{"IdRegistro":11,"GlsSiglaCategoria":"Tipo Permiso","GlsValor":"Menu"},{"IdRegistro":12,"GlsSiglaCategoria":"Tipo Permiso","GlsValor":"Columna de Grilla"},{"IdRegistro":13,"GlsSiglaCategoria":"Tipo Dato Parametro","GlsValor":"Booleano"},{"IdRegistro":14,"GlsSiglaCategoria":"Tipo Dato Columna Grilla","GlsValor":"Booleano"}]

The thing is that the "json/crud/GrillaCRUDJson.aspx" file exists in that path and it just has a reference to Request.Params. I've put a breakpoint in the code behind of that page (GrillaCRUDJson.aspx.cs in the Page_load event) but it doesn't even get called. IDK what could be happening since there's no feedback of the error.

Does the pqGrid("exportExcel"... expect some particular URL? Some obscure GET or POST parameters?.

I hope you can let me a hand on this!
Help is really appreciated.

Thanks in advance!

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Error 500 when invoking pqGrid("exportExcel"...
« Reply #1 on: January 19, 2016, 12:16:40 am »
The grid sends extension and excel POST parameters to the server script as can be seen in the server script tab:

http://paramquery.com/demos/export

Code: [Select]
[HttpPost, ValidateInput(false)]       
public String excel(String extension, String excel)

It's important to get feedback of the 500 server error. Please see the browser's network console to see the error details. If the details are missing, then error output needs to be enabled in web.config file.