Hello Dan,
Thank you for the provided code snippets. In order to send an additional parameter to the Razor Controller, try extending the "kendo.antiForgeryTokens" object.
Here is an example:
Grid method
.Update(u => u.Url("/Index?handler=Update").Data("sendingAdditionalParameter"))
Function handler (returning a value from a custom input field)
<input type="type" name="testInputVal" id="testInput"/>
function sendingAdditionalParameter() {
var testInputVal = $("#testInput").val();
return $.extend(kendo.antiForgeryTokens(), testInputVal);
}
In the Update method of the Controller, the input value will be received as a string "testInputVal" parameter:
public JsonResult OnPostUpdate([DataSourceRequest] DataSourceRequest request, OrderViewModel order, string testInputVal)
{
orders.Where(x => x.OrderID == order.OrderID).Select(x => order);
return new JsonResult(new[] { order }.ToDataSourceResult(request, ModelState));
}
I hope this information helps.
Kind Regards,
Anton Mironov
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).