I am getting trouble editing the data in grid. The data is not selected in this case. It throws an error and while clicking link http://localhost:39302/FlightInfo/GetFlightStatusById?FId=1462 it throws error. Let me know the issue behind this. Thanks in advance.
public JsonResult GetFlightStatusById(int FId)
{
tblFlightSchedule model = db.tblFlightSchedules.SingleOrDefault(x => x.FId == FId);
string value = string.Empty;
value = JsonConvert.SerializeObject(model, Formatting.Indented, new JsonSerializerSettings
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
});
var jsonResult = Json(value, JsonRequestBehavior.AllowGet);
jsonResult.MaxJsonLength = int.MaxValue;
return jsonResult;
}
JS:
function EditFlightRecord(FId) {
debugger;
var url = "/FlightInfo/GetFlightStatusById?FId=" + FId;
$("#ModalTitle").html("Update Flight Status");
$("#MyModal").modal();
$.ajax({
type: "GET",
url: url,
success: function (data) {
var obj = JSON.parse(data);
$("#FId").val(obj.FId);
The following error occurs: An exception of type 'System.OutOfMemoryException' occurred in mscorlib.dll but was not handled in user code. The function evaluation was disabled because of an out of memory exception.