I'm building a 'sample' project in asp.net MVC for my clients to show them how to interface with our services, and i'm using kendo core which means no MVC wrappers. Basically i have the javascript:
which works fine when using MVC wrappers, and the 'read' url for the controller looks like
but it does NOT work if i change the controller to not use the wrapper, like:
what do i need to change in the javascript to make this wrapper-less controller work?
function loadAttGrid() {
var attgeturl = "@Url.Action("_GetAttachmentListJSON", "Attachment", new { area = "MVCPlug", id = ViewContext.RouteData.Values["id"] }, null)";
var attupdateurl = "@Url.Action("_UpdateAttachment", "Attachment", new { area = "MVCPlug", id = ViewContext.RouteData.Values["id"] }, null)";
var attdeleteurl = "@Url.Action("_DeleteLogEntry", "Attachment", new { area = "MVCPlug", id = ViewContext.RouteData.Values["id"] }, null)";
$("#attgrid").kendoGrid({
dataSource: {
transport: {
read: {
url: attgeturl,
type: "GET",
dataType:"json"
},
update: {
url: attupdateurl,
type: "POST",
dataType: "json"
},
destroy: {
url: attdeleteurl,
type: "POST",
dataType: "json"
}
},
parameterMap: function (options, operation) {
if (operation !== "read" && options.models) {
return { models: kendo.stringify(options.models) };
}
},
pageSize: 10,
schema: {
model: {
id: "LogEntryGUID",
fields: {
LogEntryGUID: { editable: false },
FileName: { editable: false },
FriendlyUserName: { editable: false },
LocationString: { editable: false },
EventDescription: { editable: true },
FormattedDateCreated: { type: "date", editable: false }
}
}
}
},
selectable: false,
sortable: true,
filterable: true,
editable: "inline",
pageable: {
refresh: false,
pageSizes: false,
buttonCount: 5
},
columns: [
{ field: 'FileName', title: 'File Name' },
{ field: 'FriendlyUserName', title: 'User' },
{ field: 'EventDescription', title: 'Description' },
{ field: 'FormattedDateCreated', title: 'Date Created', format: "{0:G}" },
{
command: [
//define the commands here
{ name: "edit", text: " " },
{ name: "destroy", text: " " }
],
title: " ", width: "85px"
}
]
});
}
public ActionResult _GetAttachmentListJSON([DataSourceRequest] DataSourceRequest, Guid id)
{
Models.ArrayOfFullLogEntry theAtts = null;
if (id != Guid.Empty)
{
theAtts = GetAttList(id);
}
return Json(theAtts.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
public ActionResult _GetAttachmentListJSON(Guid id)
{
Models.ArrayOfFullLogEntry theAtts = null;
if (id != Guid.Empty)
{
theAtts = GetAttList(id);
}
return Json(theAtts, JsonRequestBehavior.AllowGet);
}