Hello, I'm updating a table online, related one to many, this is my structure.
 My interface, aki edito a row online, in this case, I click on "edit" and a fileupload appears, where I choose my file. Then press "burn", and if I update in the bd, but the grid does not update me and an error. It seems to me that when it is a single table if it works normal, but when the table is related it does not work and this error comes out:
My interface, aki edito a row online, in this case, I click on "edit" and a fileupload appears, where I choose my file. Then press "burn", and if I update in the bd, but the grid does not update me and an error. It seems to me that when it is a single table if it works normal, but when the table is related it does not work and this error comes out: 
This is my code for how you sent the data by ajax:
     - var UserModel =  
-              {  
-                  "id": id,  
-                  "nombre_archivo": nombre_archivo  
-              };  
-          $.ajax({  
-              url: base_url(url_editar_grid),  
-              data: JSON.stringify(UserModel),  
-              type: 'POST',  
-              contentType: 'application/json; charset=utf-8',  
-              success: function (data) {  
-                  $('#listGrid').trigger('reloadGrid');  
-                 
-              }  
-          });  
 
As receipt on controller: 
     - public JsonResult editar(periodo model)  
-         {  
-             var periodolista = new periodo();  
-             periodolista = periodolista.actualizarbatch(model.id, model.nombre_archivo);  
-              return Json(periodolista);  
-         }  
 
In the model: 
     - public periodo actualizarbatch(int varid, string varnombre)  
-       {  
-           var periodolista = new periodo();  
-           try  
-           {  
-               using (var ctx = new ProyectoContext())  
-               {  
-                       periodolista = ctx.periodo.Where(x => x.id == varid).SingleOrDefault();  
-   
-                       if (!(periodolista == null))  
-                       {  
-                           periodolista.nombre_archivo = varnombre;  
-                       }  
-                   ctx.SaveChanges();  
-   
-               }  
-   
-           }  
-           catch (Exception)  
-           {  
-   
-               throw;  
-           }  
-           return periodolista;  
-       }  
 
And as a weapon my jqgrid in the controller:
     - ProyectoContext db = new ProyectoContext();  
-         [AcceptVerbs("Get", "Post")]  
-         public JsonResult GetTodoLists(JqGrid jqgrid, string sidx, string sord, int page, int rows)    
-         {  
-             using (var ctx = new ProyectoContext())  
-             {  
-                 ctx.Configuration.LazyLoadingEnabled = false;  
-   
-                 int pageIndex = Convert.ToInt32(page) - 1;  
-                 int pageSize = rows;  
-                   var todoListsResults = db.periodo.Select(a => new{a.id, a.añoId, a.trimestre,a.nombre_archivo,a.descripcion_archivo,a.fecha_creacion});  
-   
-                 int totalRecords = todoListsResults.Count();  
-                 var totalPages = (int)Math.Ceiling((float)totalRecords / (float)rows);  
-   
-                   
-   
-                 if (sord.ToUpper() == "ASC")  
-                 {  
-                     todoListsResults = todoListsResults.OrderByDescending(s => s.id);  
-                     todoListsResults = todoListsResults.Skip(pageIndex * pageSize).Take(pageSize);  
-                 }  
-                 else  
-                 {  
-                     todoListsResults = todoListsResults.OrderBy(s => s.id);  
-                     todoListsResults = todoListsResults.Skip(pageIndex * pageSize).Take(pageSize);  
-                 }  
-                   
-   
-                 var jsonData = new  
-                 {  
-                     total = totalPages,  
-                     page,  
-                     records = totalRecords,  
-                     rows = todoListsResults  
-                 };  
-                 return Json(jsonData, JsonRequestBehavior.AllowGet);  
-             }  
-         }  
 
Please answer some, I'm stuck on this, thanks.