Hello,
I'm trying to implement the grid CRUD operation using a MVC controller. As you can see the grid vistualization is enabled and dealing with an OData web service.
Here's the code of the destroy method in the MVC controller:
I think I'm close to the solution. The Destroy method is called as expected but the jsonData parameter is always empty. I tried several permutation ( jsonData parameter as string / Patient / List(Of Patient) / IEnumerable(Of Patient) ) without success.
I saw some examples on the web but none of them dealing with OData.
What am I missing here?
Best regards,
Simon
I'm trying to implement the grid CRUD operation using a MVC controller. As you can see the grid vistualization is enabled and dealing with an OData web service.
<script> $(document).ready(function () { $("#grid").kendoGrid({ dataSource: { schema: { model: { id: "RecordID", fields: { RecordID: { editable: false, nullable: true }, FirstName: { editable: true }, LastName: { editable: true } } } }, type: "odata", serverPaging: true, serverSorting: true, pageSize: 100, batch: false, transport: { read: "http://localhost:1625/Data/GetPatients", create: { url: "http://localhost:1625/Data/Create", contentType: "application/json; charset=utf-8", type: "POST" }, update: { url: "http://localhost:1625/Data/Update", contentType: "application/json; charset=utf-8", type: "POST" }, destroy: { url: "http://localhost:1625/Data/Destroy", contentType: "application/json; charset=utf-8", type: "POST", dataType: "json" }, parameterMap: function (data, operation) { if (operation !== "read") { return { jsonData: kendo.stringify(data) }; } else { return kendo.data.transports["odata"].parameterMap(data, operation); } } } }, height: 500, scrollable: { virtual: true }, editable: true, sortable: true, toolbar: ["create", "save"], columns: ["RecordID", "FirstName", "LastName", { command: "destroy"}] }); });</script>Here's the code of the destroy method in the MVC controller:
<System.Web.Mvc.HttpPost()> _Public Function Destroy(ByVal jsonData As List(Of Patient)) As System.Web.Mvc.ActionResult 'Code to delete the record... Return Json(Nothing)End FunctionI think I'm close to the solution. The Destroy method is called as expected but the jsonData parameter is always empty. I tried several permutation ( jsonData parameter as string / Patient / List(Of Patient) / IEnumerable(Of Patient) ) without success.
I saw some examples on the web but none of them dealing with OData.
What am I missing here?
Best regards,
Simon