Hi Egor,
Thanks for using Syncfusion products.
You can pass the additional key values using the Headers of the ejDataManager. While performing update (save) action in the actionBegin event, add the required number of array of objects into Headers and retrieve them using the Request object of the HttpRequestMessage.
Refer to the below code example,
@(Html.EJ().Grid<object>("FlatGrid") .Datasource(ds => ds.Json((System.Collections.IEnumerable)ViewBag.DataSource).UpdateURL("/Home/Update").InsertURL("/Home/Insert").RemoveURL("/Home/Delete").Adaptor(AdaptorType.RemoteSaveAdaptor)) .ClientSideEvents(events => { events.ActionComplete("complete").ActionBegin("begin"); }) ) <script type="text/javascript"> var id = @Model.Id; //Getting ID from Model, considering Model as Community object. function begin(args) { if (args.requestType == 'save') { args.model.dataSource.dataSource.headers = []; args.model.dataSource.dataSource.headers.push({ "communityId": id }); //adding additional parameter to datamanager header } } function complete(args) { if (args.requestType == 'save') args.model.dataSource.dataSource.headers = [];//to avoid headers value to be interfered with other actions, emptied the Headers } </script> public ActionResult Update(List<EditableOrder> value) { int obj = Int32.Parse(Request.Headers.GetValues("communityId")[0]); //additional parameter communitId . . . . . . . . return Json(data, JsonRequestBehavior.AllowGet); } |