I am following the directions for batch editing mode here:
https://demos.telerik.com/aspnet-mvc/grid/editing
When I disable server operation, I assume I am getting a LOT of records back from the database (50K+) and this is causing the following error: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
How can I use ServerOperation for Paging/Sorting/Filtering functionality, but still use Batch with InCell editing mode?
Controller Code:
public
ActionResult Contacts_Read([DataSourceRequest]DataSourceRequest request)
{
var dbcontext =
new
CRMDataModel2();
IQueryable<vw_CRM_GetCompanyContacts> contacts = dbcontext.vw_CRM_GetCompanyContacts;
DataSourceResult result = contacts.ToDataSourceResult(request, contact =>
new
{
Comp_Secterr = contact.Comp_SecTerr,
PersonLinkId = contact.PersonLinkId,
Office = contact.Office,
Company = contact.Company,
Year = contact.Year,
Branch = contact.Branch,
Supervisor = contact.Supervisor,
AccountManager = contact.AccountManager,
Contact = contact.Contact,
Role = contact.Role,
NPS = (
bool
)contact.NPS,
Statement = (
bool
)contact.Statement,
Invoices = (
bool
)contact.Invoices,
FieldReport = (
bool
)contact.FieldReport,
RainContact = (
bool
)contact.RainContact,
});
return
Json(result);
}
View Code:
//grid is set to incell editing
.Ed
table(editable => editable.Mode(GridEditMode.InCell))
//data source is set to server operation false, batch trueDataSource(dataSource =>
dataSource.Ajax()
.ServerOperation(
false
)
.Batch(
true
)
.Read(read => read.Action(
"Contacts_Read"
,
"ContactMaintenance"
))
.Update(update => update.Action(
"Contacts_Update"
,
"ContactMaintenance"
))
.Destroy(destroy => destroy.Action(
"Contacts_Destroy"
,
"ContactMaintenance"
))
//...omitted for brevity