Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>How have you implemented your controller action method? Does it handles the request and return properly? It should be something like this:</p> <pre><code>public ActionResult EditingInline_Create([DataSourceRequest] DataSourceRequest request, ProductViewModel product) { if (product != null &amp;&amp; ModelState.IsValid) { SessionProductRepository.Insert(product); } return Json(new [] { product }.ToDataSourceResult(request, ModelState)); } </code></pre> <p>Note the first argument DataSourceRequest and teh return type Json. Maybe that's what you're missing. Also I noticed that you're indicating ServerOperation(true). As far as I understand, you should not need that if you are using AJAX Binding as you are.</p> <p>EDIT: And so for the controller code, something like this:</p> <pre><code> public partial class TextosController : EditorImageBrowserController { public ActionResult ReadTextos([DataSourceRequest]DataSourceRequest request) { CostSimulatorModel modelo = new CostSimulatorModel(new Uri(@"http://localhost:53212/CostSimulatorModelService.svc/")); IQueryable&lt;Texto&gt; textos = modelo.Textos; DataSourceResult resultado = textos.ToDataSourceResult(request); ViewData["Textos"] = textos; return Json(resultado, JsonRequestBehavior.AllowGet); } public ActionResult CreateTexto([DataSourceRequest]DataSourceRequest request, Texto texto) { if (ModelState.IsValid) { CostSimulatorModel modelo = new CostSimulatorModel(new Uri(@"http://localhost:53212/CostSimulatorModelService.svc/")); // Create a new Product entity and set its properties from the posted ProductViewModel Texto entity = new Texto { TextoID = texto.TextoID, Titulo = texto.Titulo, Corpo = texto.Corpo, IsPrivado = texto.IsPrivado, TipoTextoID = texto.TiposTexto != null ? texto.TiposTexto.TipoTextoID : texto.TipoTextoID, TiposTexto = texto.TiposTexto }; modelo.AddToTextos(entity); // Insert the entity in the database modelo.SaveChanges(); // Get the ProductID generated by the database texto.TextoID = entity.TextoID; return Json(new[] { entity }.ToDataSourceResult(request, ModelState)); } // Return the inserted product. The grid needs the generated ProductID. Also return any validation errors. return Json(new[] { texto }.ToDataSourceResult(request, ModelState)); } public ActionResult UpdateTexto([DataSourceRequest]DataSourceRequest request, Texto texto) { if (ModelState.IsValid) { CostSimulatorModel modelo = new CostSimulatorModel(new Uri(@"http://localhost:53212/CostSimulatorModelService.svc/")); // Create a new Product entity and set its properties from the posted ProductViewModel var entity = new Texto { TextoID = texto.TextoID, Titulo = texto.Titulo, Corpo = texto.Corpo, IsPrivado = texto.IsPrivado, TipoTextoID = texto.TiposTexto != null ? texto.TiposTexto.TipoTextoID : texto.TipoTextoID, TiposTexto = texto.TiposTexto }; // Attach the entity modelo.AttachTo("Textos", entity); modelo.UpdateObject(entity); // Update the entity in the database modelo.SaveChanges(); return Json(new[] { entity }.ToDataSourceResult(request, ModelState)); } // Return the updated product. Also return any validation errors. return Json(new[] { texto }.ToDataSourceResult(request, ModelState)); } public ActionResult DestroyTexto([DataSourceRequest]DataSourceRequest request, Texto texto) { if (ModelState.IsValid) { CostSimulatorModel modelo = new CostSimulatorModel(new Uri(@"http://localhost:53212/CostSimulatorModelService.svc/")); // Create a new Product entity and set its properties from the posted ProductViewModel var entity = new Texto { TextoID = texto.TextoID }; // Attach the entity modelo.AttachTo("Textos", entity); // Delete the entity modelo.DeleteObject(entity); // Delete the entity in the database modelo.SaveChanges(); return Json(new[] { entity }.ToDataSourceResult(request, ModelState)); } // Return the removed product. Also return any validation errors. return Json(new[] { texto }.ToDataSourceResult(request, ModelState)); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload