Hello,
I have a simple Ajax Kendo Grid which looks the following:
The grid renders fine without any problems when the amount of data is low.
Now if I have a lot of data in the grid (the table in the database has a few thousand rows), I get an error from Kendo when serializing the grid data:
InvalidOperationException: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
It seems that the JavaScriptSerializer that Kendo uses does not use the maximum valid json length and instead uses the default length. I have set the following entries in my web.config, which does not make any differences:
So I assume the JavaScriptSerializer you use for the Kendo Grid simply ignores this setting. What about setting the MaxJsonLength property for the JavaScriptSerializer hardcoded to its maximum value:
Would that be possible for you do set that property to its max value?
Any other ideas how I can use the grid with big data?
I know, I could use paging, but the customer does not want a paged grid ...
Please help, thanks!
Greets
PS: I have attached an image of the exact error message including the full callstack.
I have a simple Ajax Kendo Grid which looks the following:
@(Html.Kendo().Grid(m)
.Name(gridName)
.BindTo(m)
.ToolBar(commands => commands.Create().Text(newButtonText))
.Events(e => e.Edit("onGridCellEdit" + gridName))
.DataSource(dataSource => dataSource.Ajax().Events(ev => ev.Change("onDataSourceChange" + gridName))
.Model(model =>
{
model.Id(p => p.ID);
model.Field(p => p.Function).DefaultValue((KeyValueObjectViewModel)ViewData[SAPController.GRID_DDL_PROPERTY_FUNCTION + "_Default"]);
model.Field(p => p.SAPClientEmpty).DefaultValue((KeyValueObjectViewModel)ViewData[SAPController.GRID_DDL_PROPERTY_SAP_CLIENT_EMPTY + "_Default"]);
model.Field(p => p.Person).DefaultValue(new ResultEntryViewModel(true, false));
}).ServerOperation(false)
)
.Columns(columns =>
{
columns.Bound(p => p.Function).ClientTemplate("#=Function.Name#").Width(200).Title(Strings.ColumnFunction);
columns.Bound(p => p.SAPClientEmpty).ClientTemplate("#=SAPClientEmpty.Name#").Width(200).Title(Strings.ColumnSAPClient);
columns.Bound(p => p.Person).ClientTemplate("#=Person.Name#").Title(Strings.ColumnPerson);
columns.Template(@<
text
></
text
>).Width(20).ClientTemplate(TemplateConstants.GRID_CLIENTTEMPLATE_DELETE_COLUMN);
})
.Editable(editing => editing.Mode(GridEditMode.InCell).CreateAt(GridInsertRowPosition.Bottom))
)
Now if I have a lot of data in the grid (the table in the database has a few thousand rows), I get an error from Kendo when serializing the grid data:
InvalidOperationException: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
It seems that the JavaScriptSerializer that Kendo uses does not use the maximum valid json length and instead uses the default length. I have set the following entries in my web.config, which does not make any differences:
<
system.web.extensions
>
<
scripting
>
<
webServices
>
<
jsonSerialization
maxJsonLength
=
"2147483647"
/>
</
webServices
>
</
scripting
>
</
system.web.extensions
>
JavaScriptSerializer ser = new JavaScriptSerializer();
ser.MaxJsonLength = Int32.MaxValue;
// TODO: Do the Kendo Grid serialization ...
Any other ideas how I can use the grid with big data?
I know, I could use paging, but the customer does not want a paged grid ...
Please help, thanks!
Greets
PS: I have attached an image of the exact error message including the full callstack.