When I try to print a datatable using an ajax and with the .html function I get the internal server error?

0

Well, my problem is that when I try to print on the tbody of my datatble, the string information I get from my sql server query marks the internal server error, but not always, only when the text string is very long, for example if there are 50 records there is no problem and it makes the correct impression but if they are already 30 or 400, I get the error internal server error.

aspx.cs code

[WebMethod]
public static string getInforRecords(int idUpload,int tipoFile)
{
    UploadGEOController geocont = new UploadGEOController();
    List<UploadGEO> listgeo = new List<UploadGEO>();
    string htmlreturn = "";

    listgeo = geocont.RecordsExcel(idUpload,tipoFile);

    foreach (UploadGEO elemento in listgeo) {
        htmlreturn += "<tr><td>" + elemento.AreaFuncional + "</td><td>" + elemento.DominioFuncional + "</td><td>" + elemento.Periodo + "</td><td>" + elemento.Proveedor + "</td>" +
        "<td> <div class='col-lg-12 text-center'><i id='ModalRecords' class='fa fa-eye' title='Aqui Usted podra ver detalles'  aria-hidden='true' style='cursor:pointer;'></i></div>" +
        "" +
        "</td></tr>";
    }


    return htmlreturn;

}

Code .js

function getRecords(idExcel,tipoFile) {
    $("#IdRecords").removeClass("hidden");
    $.ajax({
        type: "POST",
        url: "AdminView.aspx/getInforRecords",
        data: '{idUpload:"' + idExcel + '",tipoFile:"' + tipoFile + '"}',
        contentType: 'application/json; charset=utf-8',
        dataType: "json",
        success: function (result) {
            //console.log(result.d);
            $("#tbodyRecord").html(result.d);
            //Genera el formato de datatable a la tabla
            tableRecord = $('#tableRecords').DataTable({
                language: {
                    url: 'Json/SpanishDataTable.json'
                }
            });

        },
        error: function (xhr, status, error) {
            alert(error,status,xhr)
        }
    });
}

I really do not know what the problem is, I do not know if there is any kind of limit or something like that when I return the chain.

    
asked by David 11.12.2018 в 20:40
source

0 answers