I am receiving this error and I know what the reason is. I found multiple discussions of this problem: here, here, and here for example
They would work for me but my action retruns a partial view instead of Json result:
public ActionResult GetData(string key)
{
var model = dB.GetSata(key);
return PartialView("~/Areas/Admin/Views/InfoPartial.cshtml",model);
}
@model MyWeb.Models.InfoModel
@if (Model != null)
{
@(Html.Kendo().Grid<MyWeb.Models.InfoModel>().Name("Info").BindTo(Model))
//... more code here
}
How do I incorporate my custom js serializer with extended length:
var serializer = new JavaScriptSerializer();
serializer.MaxJsonLength = Int32.MaxValue;
var result = new ContentResult
{
Content = serializer.Serialize(sites),
ContentType = "application/json",
};
into my Action code when I need to return a PartialView ?
PS: this does not work
<jsonSerialization maxJsonLength = "2147483647"></jsonSerialization>