I have a kendo grid and its using a kendo dataSource, I am not used to using the kendo dataSource, to do inline editing, typically I would never do inline editing but I was requested to do so.
My dataSource is as follows
function PriceLookupGridDataSource() {
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "../KendoGridTesting/GetThePriceLookupGrid",
dataType: "json"
},
update: {
url: function(item) {
console.log(item);
return "../KendoGridTesting/PassAnObject?myObj=" + item;
}
}
},
schema: {
model: {
id: "MaterialTypeID",
fields: {
VendorID: { type: "number" },
VendorName: { type: "string" },
Description: { type: "string" },
MaterialTypeID: { type: "number" },
MaterialType: { type: "string" },
ServicePrice: { type: "string" },
SellUOM: { type: "string" },
Cost: { type: "string" },
PurchaseUOM: { type: "string" }
}
}
},
batch: false,
pageSize: 20
});
return dataSource;
}
The controller method that is used for the transport update is
[HttpPost]
public void PassAnObject(PriceLookupGrid myObj)
{
...
}
The object is
Object {VendorID: 26, VendorName: "ACME STONE MASONRY", Description: "Special Stone Quote", MaterialTypeID: 35, MaterialType: "Cladding"…}
and the PriceLookupGrid data class is
public class PriceLookupGrid
{
public int VendorID { get; set; }
public string VendorName { get; set; }
public string Description { get; set; }
public int MaterialTypeID { get; set; }
public string MaterialType { get; set; }
public string NewPrice { get; set; }
public string RemodelPrice { get; set; }
public string ServicePrice { get; set; }
public string SellUOM { get; set; }
public string Cost { get; set; }
public string PurchaseUOM { get; set; }
}
When I try to pass this over to my controller I get an error
GET http://localhost:51193/KendoGridTesting/PassAnObject?id=[object%20Object]&V….0000&ServicePrice=0.0000++++&SellUOM=Each&Cost=0.0000&PurchaseUOM=EachBBB 404 (Not Found)
Its passing the "item" over as seperate parameters and I don't want that happening.
Any idea's?