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.

Error during serialization or deserialization using the JSON JavaScriptSerializer

Thread ID:

Created:

Updated:

Platform:

Replies:

125692 Sep 3,2016 04:13 AM Sep 7,2016 09:24 AM ASP.NET Web Forms 3
loading
Tags: Grid
Martin Sickel
Asked On September 3, 2016 04:13 AM

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.

Martin 

Attachment: Demo_4c76271d.zip

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

Hi Martin, 

Thanks for contacting Syncfusion Supports. 

Please find the response.              
Query 
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 
 


Regards, 
J.Mohammed Farook 


Martin Sickel
Replied On September 5, 2016 03:52 AM

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 09:24 AM

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" 
                    ShowStackedHeader="True" 
                    AllowScrolling="true" 
                   AllowFiltering="true" 
                   AllowResizeToFit="true" 
                    Selectiontype="Single"  
       > 
        <Columns> 
            . 
            . 
        </Columns> 
    </ej:Grid> 
   <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 
                   }); 
       } 
 
</script> 


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. 

Regards, 
K.Karthick. 


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.

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.

;