I am using DataTable for displaying the list of product, the product include picture, when i return json file from my controller it gives me error
Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property
I configure my web.config as
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483644"/>
</webServices>
</scripting>
</system.web.extensions>
if i return json without picture is display properly, is there any solution to return a list of picture using json.
and my controller is
public JsonResult CustomServerSideSearchAction(DataTableAjaxPostModel model)
{
int filteredResultsCount;
int totalResultsCount;
var res = CustomSearchFunc(model, out filteredResultsCount, out totalResultsCount);
var result = new List<ProductGrid>(res.Count);
result.AddRange(res.Select(s => new ProductGrid
{
ProductImage = s.ProductImage,
ProductId = s.ProductId,
ProductName = s.ProductName,
ProdutCode = s.ProdutCode,
ProductPrice = s.ProductPrice,
ProductQuantity = s.ProductQuantity,
HeadOfficeId = s.HeadOfficeId,
BranchOfficeId = s.BranchOfficeId
}));
if (totalResultsCount < model.length)
totalResultsCount = model.length;
return Json(new
{
model.draw,
recordsTotal = totalResultsCount,
recordsFiltered = filteredResultsCount,
data = result
}, JsonRequestBehavior.AllowGet);
}
how can i resolve this problem???? thanks....