asp.net mvc - KendoUI grid never fires destroy method -
my kendoui never fires destroy method ? doing wrong. grid show data fails delete 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, requested resource not support http method 'delete'
this not problem kendo, httpdelete.
problem webdav module , answears this link work me well. in short change web.config:
<system.webserver> <modules> <remove name="webdavmodule" /> </modules> <handlers> <remove name="webdav" /> </handlers> </system.webserver>
Comments
Post a Comment