I am Binding data to Kendo grid using Ienumerable not with Json Data .
Am Getting this Error : Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
Even after tried with setting below maxjsonlength in web.config
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483647" />
</webServices>
</scripting>
Here is my kendo Grid
@model IEnumerable<AssetTrackingSystem.Model.SampleDetailsSummary>
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns=>
{
columns.Bound(p => p.JobNumber).Title("Job Number").Width("125px");
columns.Bound(p => p.SampleNumber).Template(@<text></text>).ClientTemplate("<a href='" + Url.Action("SampleDetails", "JobDetails", new { AssetId = "#=AssetId#" }) + "'>#=SampleNumber#</a>").Title("Sample Number").Width("125px");
columns.Bound(p => p.SampleType).Title("Sample Type").Width("125px");
columns.Bound(p => p.ServiceVendor).Title("Service Vendor").Width("125px");
columns.Bound(p => p.BarCode).Title("Barcode").Width("125px");
columns.Bound(p => p.LocationName).Title("Current Location").Width("125px");
columns.Bound(p => p.GPS).Title("GPS").Width("125px");
}).Pageable().Sortable().Scrollable(scr => scr.Height(scroolheight)).Filterable().Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5)).DataSource(dataSource => dataSource
.Ajax()
.PageSize(50)
.ServerOperation(false)
.Model(model => model.Id(p => p.AssetId))
)
Here is my controller action Method
public ActionResult CompanyAssets()
{
Guid CompanyId = new Guid(Request.Params["CompanyId"].ToString());
int GPSOnly = int.Parse(Request.Params["Gps"]);
//bool GPSOnly = GPSOnly1.Equals("1") ? true : false;
JobDetailsRepository rep = new JobDetailsRepository(Session["Connectionstring"].ToString());
// IList<AssetDetails> assetinfo = rep.GetAssetsByCompanyId(CompanyId);
IList<SampleDetailsSummary> assetinfo = rep.GetAllSamplesByCompanyId(CompanyId, GPSOnly);
CompanyRepository cmprep = new CompanyRepository(Session["Connectionstring"].ToString());
// IList<CompanyInfoSummary> s = cmprep.GetLocationsByCompanyId(CompanyId);
var company = cmprep.GetCompany(CompanyId);
ViewBag.companyName = company.CompanyName;
var model = assetinfo;
return View(model);
}
Can any one please help me through this am trying to fix these spending 24 hours