or
read: {
url: "http://localhost:58871/grid-wcf-crud/Products.svc/Read", //specify the URL which data should return the records. This is the Read method of the Products.svc service.
contentType: "application/json; charset=utf-8", // tells the web service to serialize JSON
type: "POST" //use HTTP POST request as the default GET is not allowed for svc
},
<
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
>
<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
Function