I have a web api controller as follows:
As you can see with the line " data: { Frequency:"GGGG", Id: 1 }," I am setting the data so that the VHFMasterList object that is sent to my controller is initialized properly. My question is how do I make it so that I can skip this step? Is it possible to have kendo know how to initialize this object based on the data in the grid?And as a side note if anyone knows, if this is not possible, how would I read this data from the kendo grid so that I can set my object with the actual data of the row? Thanks.
// PUT: api/VHFMasterLists [ResponseType(typeof(void))] public IHttpActionResult PutVHFMasterList(VHFMasterList vHFMasterList) { if (!ModelState.IsValid) { return BadRequest(ModelState); } return StatusCode(HttpStatusCode.NoContent); }
I then have a datasource as follows:
var tmpdataSource = new kendo.data.DataSource({
transport: {
read: {
url: crudServiceBaseUrl + "api/VHFMasterLists",
dataType: "json"
},
update: {
url: crudServiceBaseUrl + "api/VHFMasterLists",
dataType: "json",
data: { Frequency:"GGGG", Id: 1 },
type: "PUT",
contentType: "application/json; charset=utf-8",
},
parameterMap: function (model, operation) {
if (operation !== "read" && model) {
return kendo.stringify(model);
}
}
},
batch: true,
pageSize: 20,
schema: {
model: {
id: "Id",
fields: {
Id: { editable: false,
nullable: false,
type: "number"
},
Frequency: { type: "string"}
}
}
}
});
As you can see with the line " data: { Frequency:"GGGG", Id: 1 }," I am setting the data so that the VHFMasterList object that is sent to my controller is initialized properly. My question is how do I make it so that I can skip this step? Is it possible to have kendo know how to initialize this object based on the data in the grid?And as a side note if anyone knows, if this is not possible, how would I read this data from the kendo grid so that I can set my object with the actual data of the row? Thanks.