We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to load many records in grid

Thread ID:

Created:

Updated:

Platform:

Replies:

121769 Jan 22,2016 05:14 PM Feb 2,2016 06:49 AM ASP.NET Web Forms 3
loading
Tags: Grid
Roimer Machacón Otero
Asked On January 22, 2016 05:14 PM

Hi, we're using grid in our application, Now when we have many records database, appear this error:

Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

Notes: We're using syncfusion version: 12.2.0.36 and in the web.config have this configuration:

  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="2147483647"/>
      </webServices>
    </scripting>
  </system.web.extensions>


Balaji Marimuthu [Syncfusion]
Replied On January 25, 2016 07:28 AM

Hi Roimer,

Thanks for contacting Syncfusion support.

To bind large number of records to Grid, we suggest you to use the UrlAdaptor in Grid, which works based on the load on demand concept. It retrieves the data when the paging operation performed (based on page size) and do not retrieve all the records. 


We have created a sample with 30000 records. Refer to the sample and Help document. 

Sample: Sample-UrlAdaptor

Document: http://help.syncfusion.com/aspnet/grid/editing#url-adaptor


<ej:Grid ID="Grid1"  ClientIDMode="Static" AllowPaging="True"   runat="server" Load="load">

            <DataManager URL="/Grid/GridFeatures.aspx/Data" Adaptor="UrlAdaptor"  />

            <Columns>

                <ej:Column Field="CustomerID" HeaderText="Customer ID"   Width="100"  />

               <ej:Column Field="ContactName" HeaderText="Contact Name" Width="100" />

                <ej:Column Field="City" HeaderText="Ship City" Width="100" />

                <ej:Column Field="Address" HeaderText="Address" Width="100" />

            </Columns>

        </ej:Grid>

[Controller]


[WebMethod]

        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]

        public static object Data(int skip, int take)

        {


            var DataSource = new NorthwndDataContext()._30000Records.ToList();


            var result = DataSource.Skip(skip).Take(take);


            int count = DataSource.Count();


            return new { result = result, count = count };


        }


Note: Default page size is 12 if enabled the AllowPaging property.

While using the UrlAdaptor in the version 12.2.0.36 we faced an issue but, it’s fixed in the latest version. So we have achieved your requirement using the custom Adaptor in Grid and suggest you to upgrade to the latest version from the following link,

http://www.syncfusion.com/forums/121657/essential-studio-2015-volume-4-final-release-v13-4-0-53-is-available-for-download



<%--no need for the below code if use latest version 13.4.0.53--%>

<script type="text/javascript">


        var customadaptor = new ej.UrlAdaptor().extend({

         

                processResponse: function (data, ds, query, xhr, request, changes) {

                    if(data.d)

                        data = data.d

                   return ej.UrlAdaptor.prototype.processResponse.apply(this, [data, ds, query, xhr, request, changes])

                }


        });


        function load(args) {

            this.model.dataSource.adaptor = new customadaptor();  //custom adaptor

        }


    </script>


Note: No need to use the above code example, when use the latest version

Regards,
Balaji Marimuthu

Roimer Machacón Otero
Replied On February 1, 2016 03:11 PM

Hi, 

The example work correctly, now we've a little problem.

As we need to load the data according to value in a textbox, in another forum make this for obtain the value of this textbox:

Add this to definition of the grid ActionBegin="actionBegin"

function actionBegin(args) {
            this.model.query.addParams("codigoPlan", $("#txtNumeroPlan").val())
}

Now when press a linkbutton for put the form in a query mode we clean the textbox and in the grid appear permanently the gif load (Attached image), after making the query and fetch data, the data load in grid but not removed the gif load.

Attachment: grid_permanently_gif_load_f01ffe48.rar

Jayaprakash Kamaraj [Syncfusion]
Replied On February 2, 2016 06:49 AM

Hi Roimer,
Query : when press a linkbutton for put the form in a query mode we clean the textbox and in the grid appear permanently the gif load
We have analyzed your query with the code example and suspect that the $("#txtNumeroPlan").val() is as empty string( “”) while adding additional parameter to query using addparams, which is the cause for the issue. Because in server side, we pass parameter as integer and we suggest to store textbox value in any global variable before clearing the value of the input textbox. Refer to the below sample,
Sample: http://www.syncfusion.com/downloads/support/forum/121769/ze/SyncfusionASPNETApplication2-843102802

If you still face the issue in your sample, share the following,
1.  Do any script error thrown in console?
2.  Full HTML page code example.
3. If possible, a sample or modify the given sample as issue reproducible.

Regards,
Jayaprakash K.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;