0

I am using devextreme datagrid in asp.net Mvc. Datagrid works fine when I am processing 5000 data. But when I want to process with 10000 data, it cannot load the data and the internal server gives an error.

My index.cshtml;

<div class="row">
    <div class="col-lg-12">
        <h1 class="page-header col-dark-green">
            Barsan Portal <small>Gönderici/Alıcı</small>
        </h1>
        <div class="demo-container">
            <div id="gridContainer" style="height:800px"></div>
        </div>
    </div>
</div>

My index.js :

 $(function () {

            var dataSource = new DevExpress.data.DataSource("/Nakliye/GetGondericiAlicilar");
            console.log(dataSource);
            $("#gridContainer").dxDataGrid({
                dataSource: new DevExpress.data.CustomStore({
                    key: "kodu",
                    pageSize:50,
                    loadMode: "raw", // omit in the DataGrid, TreeList, PivotGrid, and Scheduler
                    load: function () {
                        return $.getJSON("/Nakliye/GetGondericiAlicilar")
                            .fail(function () { throw "Data loading error" });
                    }
                }),
                selection: {
                    mode: 'multiple'
                },
                renderAsync: true,
                allowColumnReordering: true,
                allowColumnResizing: true,
                cellHintEnabled: false,
                columnResizingMode: "nextColumn",
                showBorders: true,
                searchPanel: {
                    visible: true,
                    width: 240,
                    placeholder: "Ara..."
                },
                headerFilter: {
                    visible: true,
                },
                filterPanel: {
                    visible: true
                },
                filterRow: {
                    visible: true
                },
                loadPanel: {
                    enabled: true
                },
                groupPanel: {
                    visible: true,
                    placeholder: "Bir sütun başlığını o sütuna göre gruplandırmak için buraya sürükleyin"
                },
                pager: {
                    showPageSizeSelector: true,
                    allowedPageSizes: [10, 20, 50, 100, 200],
                    showNavigationButtons: true,
                    showInfo: true,
                    infoText: "Sayfa {0} / {1} ({2} öğe)" 
                },
                columns: [{
                    dataField: "adi",
                    caption: "Adı"
                }, {
                    dataField: "Adres",
                }, {
                    dataField: "il",
                    width: 115,
                    caption: "İl"
                }, {
                    caption: "Ülke",
                    dataField: "ulke",
                }, {
                    caption: "Posta Kodu",
                    dataField: "postakodu",
                    width: 115,
                }, {
                    caption: "Telefon",
                    dataField: "telefon",
                    width: 155,
                }, {
                    caption: "Faks",
                    dataField: "faks",
                    width: 155,
                }, {
                    caption: "İlgili",
                    dataField: "ilgili",
                    width: 195,
                }]
            });
        });

My controller about action:

 public ActionResult GetGondericiAlicilar() { return Json(_nakliyeService.GetGondericiAlicilar(), JsonRequestBehavior.AllowGet); }

GetGondericiAliciler() in My service :

 public List<gnladresbankasi> GetGondericiAlicilar()
        {
            var result = _objectRawSql.Execute(StaticParams.Connstr, typeof(gnladresbankasi),
                //sql functions 
                @"Select top 10000 kodu, adi, adres1 + ' ' + adres2 AS Adres, il, (select adi from gnlulke where kod = ulke) AS Ulke, postakodu, telefon, fax, ilgili
                FROM gnladresbankasi ab WHERE Exists(select * from gnlFirmaGondericiAlici ga WHERE ab.kodu = ga.GondericiAliciKodu)").Cast<gnladresbankasi>().ToList();
            
            return result;

        } 

As I mentioned, 5000 data works well, but when there is 10000 data, the loading icon returns and the data is not loaded. Should a special action be taken regarding big data?

  • 1
    Welcome to SO. Please pick the correct tags for your question. There is no C code involved. Is it C# or C++ or something else? Please edit your question to fix the tags accordingly. – Gerhardh Dec 11 '20 at 11:38
  • As I see to your controller code you don't have any paging functionality. That causes the population of your grid to be time-consuming. You can use the built-in DataSourceLoadOptions class from DevExtreme to pass the paging data from front to the backend of your project. – Majid Shahabfar Dec 14 '20 at 21:14

1 Answers1

0

I found the following error in the browser network tab;

Server Error in '/' Application. Error while serializing or deserializing using JSON JavaScriptSerializer. The length of the string exceeds the value set in the maxJsonLength property. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Can I set an unlimited length for maxJsonLength in web.config this solved my problem.