We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Use Grid for editing entity children items

Hi Syncfusion,

Thanks for your hard work. You are realy make the web world better:). I am a beginer in Web Development, but I can understand how to use your library without any problem.

When I implement editing of children items for intity, I want to use your Grid. 
I have a question for you. I have two entity with N<->N relationship. To edit one of them I use your grid with Datasource with type AdaptorType.RemoteSaveAdaptor. 
This datasource should get three URL for item changing at the server(UpdateURL, RemoveURL and InsertURL). In this case the standeard behaviour of these operations is not good cause for me. I need pass additional params, such as ID of parent edited entity. Are there any workaround to implement this.

Example code:

First class:

public partial class Community
    public Community()
        this.ContactCollection = new HashSet<Contact>();
        this.AddressCollection = new HashSet<Address>();
        this.AdditionInfoCollection = new HashSet<AdditionInfo>();
    public long Id { get; set; }
    public virtual ICollection<Contact> ContactCollection { get; set; }
    public virtual ICollection<AdditionInfo> AdditionInfoCollection { get; set;      }

Second class:

public partial class Address
    public Address()
        this.CommunityCollection = new HashSet<Community>();
        this.AdditionInfoCollection = new HashSet<AdditionInfo>();
    public int AddressId { get; set; }
    public string Street { get; set; }
    public string City { get; set; }
    public string Country { get; set; }
    public string HomeData { get; set; }
    public string GpsX { get; set; }
    public string GpsY { get; set; }
    public virtual ICollection<Community> CommunityCollection { get; set; }
    public virtual ICollection<AdditionInfo> AdditionInfoCollection { get; set; }

I create Edti razr-page for class Comunity and use Grid

 .Datasource(ds => ds.Json(Model.AdressesCollection.AsEnumerable<object>())
 .FilterSettings(filter => { filter.ShowFilterBarStatus().StatusBarWidth(500).FilterBarMode(FilterBarMode.Immediate); })   /*Filtering Enabled*/
 .AllowSorting()    /*Sorting Enabled*/
 .AllowPaging()    /*Paging Enabled*/
     .ClientSideEvents(eve => { eve.ActionBegin("AddressesGridBeginAction");  })
 .EditSettings(edit => edit.AllowAdding().AllowDeleting().AllowEditing())
     .ToolbarSettings(toolbar =>
         toolbar.ShowToolbar().ToolbarItems(items =>
 .Columns(col =>

at the controller should be: AddressesListUpdate(Address updateItem, int communityId)
where communityId is an address holder. 

Thank you very much!

Best regards,

3 Replies

GV Gowthami V Syncfusion Team January 29, 2016 07:15 AM UTC

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,


                 .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



public ActionResult Update(List<EditableOrder> value)


           int obj = Int32.Parse(Request.Headers.GetValues("communityId")[0]); //additional parameter communitId

. . . .

. . . .

            return Json(data, JsonRequestBehavior.AllowGet);


From your code example, we found that you are using Community object in Model. So, we are directly getting the community ID from Model.

We have already discussed about sending custom headers to the server in the following KB,



Gowthami V.

EG egor January 29, 2016 10:33 AM UTC

Hi Gowthami,
I try your suggestion and IT WORKS!!! Thank you very much!
You are the best!

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team February 1, 2016 05:58 AM UTC

Hi Egor,

We are happy to hear that the solution meets your requirement. Please let us know if you need any further assistance.

Seeni Sakthi Kumar S.

Live Chat Icon For mobile
Up arrow icon