Reputation: 3437
My kendoUI never fires destroy method ? What am I doing wrong. The grid show data properly but fails to delete the record.
$("#registration-grid").kendoGrid({
dataSource: {
type: "json",
transport: {
read: {
url: "@Html.Raw(Url.Action("List", "Participant"))",
type: "POST",
dataType: "json"
},
destroy: {
url: "http://localhost:53669/api/participant/",
type: "DELETE",
dataType: "json"
}
},
schema: { data: "Data", total: "Total", model: { id: "Id" } },
batch: false,
},
pageable: { ... },
editable: { mode: "inline" },
columns: [
{ field: "Id", title: "Id", width:50,filterable: false },
{ command: ["destroy"], title: " ", width: "250px" }
]
});
Web api controller participant: tested on fiddler /api/participant/delete/2 works
[HttpDelete]
public HttpResponseMessage Delete(int id)
{
var participant = _participantService.Get(p => p.Id == id);
if (participant == null)
return Request.CreateResponse(HttpStatusCode.BadRequest);
try
{
_participantService.Delete(participant);
return Request.CreateResponse(HttpStatusCode.OK);
}
catch (Exception)
{
return Request.CreateResponse(HttpStatusCode.BadRequest);
}
}
KendoGrid show error when click on Delete 405 Method Not Allowed, The requested resource does not support http method 'DELETE'
Upvotes: 0
Views: 949
Reputation: 3407
This is not problem with Kendo, just with HttpDelete.
Problem is with WebDAV module and answears from this link work for me very well. In short just change your web.config:
<system.webServer>
<modules>
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
</handlers>
</system.webServer>
Upvotes: 1