I am using Infragistics v16.1 and have encountered an issue where i have a web data grid with 25 columns and 1000 blank rows. After copy/paste 1000 records from excel and click submit button getting below error: "Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.".
I already set EnableAjax="false" and EnableAjaxViewState="false" and added _callbackManager.setTimeout(600000) in web data grid initialize function.
I already went through some of the posts regarding the same , but not able to find any solutions.
How to fix this issue.should I be able to find this in any documentation?
cheers
Rajesh
i have tried below steps also but no luck:
Hello Rejesh,
Thank you for your question.
Keep in mind that on paste operation, copied columns from the excel file, should match the selected WebDataGrid cells (have a look at the attached image below).
Also the data should match, if you have date value in one od the cells and you pass some string, the serialization will fail.
You can try to modify the attached sample in order to reproduce the issue and I will be able to help you further with it.
Image:
The issue is not on copy/paste. The copy paste is working fine. the exception happening on button click.
I am using Infragistics v16.1. Please find the attached solution with an excel file with data for 1000 rows.
Please run the application and copy/paste 1000 rows in the grid. The exception will be thrown after button click. (i.e. Maximum request length exceeded).
As per client, they wants minimum 1000 rows for bulk submit.
All the works are done except this exception, please help on this.
Hi Zdravko Kolev,
I forgot to add the below line in previously attached solution.But I have this line in my application for increase the timeout to 10 min and the logic is inside WebDataGridView_Initialize method.
<ClientEvents KeyUp="keyUp" Initialize="WebDataGridView_Initialize" />
Please add this line in previously attached solution to replicate the issue.
Cheers,
Hello Rajesh,
Thank you for the sample and detailed information on how to reproduce the issue.
Better approach when handling this amount of data is to proceed the upload of the file on the server, and not copy/paste it. I have created a sample in order to show you what I mean. I hope you will find the sample helpful.
Let me know if I could be of further assistance.
Hallo Zdravko Kolev,
Thanks for this approach.
But is there any way we can handle this exception and overcome the inbuilt JSON length limit during serialization of a web dataGridView content?
Our client wants to copy/paste the data into the grid.
Please help on this.
I will try a couple more things and will let you know about the results.
Thank you for your patience.
The issue is caused because of the serialization and de-serialization of returned objects. Serialization converts .net objects to XML format and when the data length exceed the limit of serialization, error is thrown. Basically our WebDataGrid has a limitation and he could not handle more than 1000 rows and 12 columns. I have used the configuration below in order to achieve this result.
Web.config:
....
<httpRuntime maxRequestLength="2147483647" /> <system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="4294967295"></requestLimits> </requestFiltering> </security> </system.webServer> <system.web.extensions> <scripting> <webServices> <jsonSerialization maxJsonLength="2147483647"></jsonSerialization> </webServices> </scripting> </system.web.extensions></configuration>
My suggestions are to follow different approaches when it comes to commit this amount of data at once:
- reduce the portions of data not to be saved at once.
- performed the data operations on the server directly (have a look at the attached sample from my previous reply).
- use our Ignite UI igGrid widget, which is client based component. Have a look at the articles below for more information:
http://es.infragistics.com/community/blogs/zdravko_kolev/archive/2016/03/15/from-asp-net-webforms-to-modern-web-technologies.aspx
http://es.infragistics.com/community/forums/t/91331.aspx
Other useful references:
https://forums.iis.net/t/1150009.aspx
https://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits
https://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.maxrequestlength(v=vs.110).aspx
http://stackoverflow.com/questions/4022434/how-to-set-the-maxallowedcontentlength-to-500mb-while-running-on-iis7
http://stackoverflow.com/questions/1151987/can-i-set-an-unlimited-length-for-maxjsonlength-in-web-config
Hi Zdravko Kolev...any updates on this?
Sure Zdravko Kolev...Please let me know if you find any solution for this...