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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Error during serialization or deserialization using the JSON JavaScriptSerializer

Thread ID:





125692 Sep 3,2016 08:13 AM UTC Sep 7,2016 01:24 PM UTC ASP.NET Web Forms 3
Tags: Grid
Martin Sickel
Asked On September 3, 2016 08:13 AM UTC

Dear All

I have prepared a small demo to show the errors I get.

I have two questions:

1. How can I prevent the above error message in the supjetc for huge data?
2. How can I prevent a whole reload of the page, so that only the grid is refreshed with the data after presing the button

Thanks for helping.


Attachment: Demo_4c76271d.zip

Mohammed Farook J [Syncfusion]
Replied On September 5, 2016 05:34 AM UTC

Hi Martin, 

Thanks for contacting Syncfusion Supports. 

Please find the response.              
1.        How can I prevent the above error message in the supjetc for huge data? 
To avoid the issue please find the steps. 
i)                    we have used the default MaxJsonLength value (2097152 characters, which is equivalent to 4 MB of Unicode string data) of the JavaScriptSerializer which is a fixed universal standard length for serializing the data. 
Please find Custom datasource serializer class will be as follows. 
public class DMSerial : IDataSourceSerializer  
        public string Serialize(object obj) 
            var str = Newtonsoft.Json.JsonConvert.SerializeObject(obj); 
            return str; 
ii)                   To use ej.Webmethod Adaptor. Please find the link. 
2.       How can I prevent a whole reload of the page, so that only the grid is refreshed with the data after presing the button 
if we are using ej.WebMethod Adaptor  , we need to handle sorting, filtering or paging in server side. So grid automatically post back occurred. this is default behavior 

J.Mohammed Farook 

Martin Sickel
Replied On September 5, 2016 07:52 AM UTC

Hi J.Mohammed

Thanks for the answer.

I understand that I have to use Datamanger to get an expected result.

If I set now the Dataadpater with the different URL sets like " URL="default.aspx/Data" ", " UpdateURL="default.aspx/update" " etc..
is there a way to execute UpdateURL with a click on a "Custom Button" like

<ej:Button ID="btnInsert" Type="Button"  runat="server" Text="Update" OnClick="btnInsert_Click" ></ej:Button> 

without refreshing the whole page? 

Karthick Kuppusamy [Syncfusion]
Replied On September 7, 2016 01:24 PM UTC

Hi Martin, 

We have analyzed the requirement and we can bind the url data  to the ejGrid using the custom button. 

Please find the code example. 

<ej:Button ID="btnInsert" Type="Button" runat="server" Text="Update" ClientSideOnClick="btnclick" ></ej:Button>  
     <ej:Grid ID="Grid" runat="server" AllowPaging="True" AllowTextWrap="True" 
   <script type="text/javascript"> 
       function btnclick(e) { 
          var data = ej.DataManager({ 
               url: "/Default.aspx/DataSource", 
               adaptor: new ej.WebMethodAdaptor() 
           var query = new ej.Query(); 
           var execute = data.executeQuery(query)  
                   .done(function (e) { 
                       var data = e.result; 
                       var obj = $("#MainContent_Grid").ejGrid("instance"); 
                       obj.dataSource(data.result);//bind the data for grid 

Please find the UG Link. 

For your reference we have created a sample based on your requirement and same it can be downloaded from the following location. 



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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