Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
public JsonResult GetPeriodById(int PeriodId) { Tbl_Periods model; model = db.Tbl_Periods.Where(s => s.Period_Id == PeriodId).SingleOrDefault(); string value = string.Empty; value = JsonConvert.SerializeObject(model, Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); return Json(value, JsonRequestBehavior.AllowGet); }
function EditStudentRecord(PeriodId) { var url = config.serverPath + "Home/GetPeriodById?PeriodId=" + PeriodId; $("#ModalTitle").html("Update Period"); $("#MyModal").modal(); $.ajax({ type: "GET", url: url, success: function (data) { var obj = JSON.parse(data); $("#pId").val(obj.Period_Id); $("#stDate").val(obj.Start_Date); $("#endDate").val(obj.End_Date); $("#projectID").val(obj.project_Id); //$("#DropDwn option:selected").text(obj.tblDepartment.DepartmentName); //$("#DropDwn option:selected").val(obj.DepartmentId); } }) }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)