RemoteSaveAdaptor Delete returns null value

In reference to the forum thread 141654 and the provided example code at:


Added removeUrl to ejs-grid:
        <e-data-manager  json ="@ViewBag.datasource" adaptor="RemoteSaveAdaptor" updateUrl="Home/Update" insertUrl="Home/Insert" removeUrl="Home/Delete" ></e-data-manager>

When I attempt to add a Delete action method to your example code like this:

    public ActionResult Delete([FromBody] CRUDModel<OrdersDetails> value)
    {
      OrdersDetails.GetAllRecords().Remove(value.value);
      return Json(value.value);
    }

The "value" property of the CRUDModel returns null.  Can you provide a sample that allows deleting of a record?

1 Reply 1 reply marked as answer

BS Balaji Sekar Syncfusion Team July 20, 2020 09:25 AM UTC

Hi Terry, 
 
Greetings from the Syncfusion support. 
 
Based on your query, we have created a sample with RemoteSaveAdaptor in DataGrid component. In below code example, we have shared code definition of Delete action in server side. Please refer the below code example and sample for more information. 
[HomeController.cs] 
public ActionResult Delete([FromBody]CRUDModel<OrdersDetails> value) 
        { 
            OrdersDetails.GetAllRecords().Remove(OrdersDetails.GetAllRecords().Where(or => or.OrderID == int.Parse(value.key.ToString())).FirstOrDefault()); 
            return Json(value); 
        } 
 
 
 
Please get back to us, if you need further assistance. 
 
Regards, 
Balaji Sekar 


Marked as answer
Loader.
Up arrow icon