Hi, this may be a dummy question but I tried to use the .Data("forgerytoken") I got from the Grid examples but this obviously change the data adding a complex structure, I would like to keep the text property I got without the .Data
Thanks in advance.
5 Answers, 1 is accepted
Hello Eliel,
The Data() method of the DataSource could be used to specify a JavaScript function that will be used to pass additional parameters along with a request. For example:
.Read(read => read.Action("Products_Read", "Grid").Data("additionalInfo"))
...
function additionalInfo() {
return {
name: "test",
testParam: 2
}
}
You could use this to pass any parameter of your choice along with the request. Then, those parameters could be accessed and processed in the server end-point:
public ActionResult Products_Read([DataSourceRequest] DataSourceRequest request, string name, int testParam) { ... }
I hope this helps. In case you have any additional questions, please let me know.
Regards,
Dimitar
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
Thanks for the answer, I would like to know if there is an easy way to get the text content or do I just simply get it with JS?
Thanks in advance!
/Eliel
Hello Eliel,
If you are referring to a MultiColunComboBox, the related item could be retrieved with JS through the dataItem() method as follows:
var mc = $("#products").getKendoMultiColumnComboBox()
var item = mc.dataItem()
console.log(item);
Regards,
Dimitar
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.
Just a side note: I just noticed that MultiColumnComboBox use GET instead of POST and therefore it is unnecessary (or not supported) send the AntiForgeryToken.
Thanks for the help!
Hello Eliel,
You could set the request to POST through the DataSource transport.read.type option to post:
.DataSource(datasource => {
datasource => datasource.Read(r => r.Action("GetProducts", "Home").Type(HttpVerbs.Post))
})
Regards,
Dimitar
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.