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

Passing Data to server in the URL Adaptor Inline form

Hello Guys,

I am using the Syncfusion MVC grid I am facing the problem while passing data to a server in sync fusion when we update the grid. Every time the update method it gives me model properties as null only even when everything seems right.
Below is my code. can anyone know what I am doing wrong or what I am missing?

Below is CSHTML code

                                                   .Datasource(datasource => datasource.URL(@Url.Action("Search")).UpdateURL(@Url.Action("Update"))
                                                    .EditSettings(edit => { edit.AllowAdding().AllowEditing().EditMode(EditMode.InlineForm).ShowConfirmDialog(true).TitleColumn("Code"); })
                                                        .ToolbarSettings(toolbar =>
                                                            toolbar.ShowToolbar().ToolbarItems(items =>
                              .SortSettings(builder => builder.SortedColumns(col => col.Field("Code").Direction(SortOrder.Ascending).Add()))
                                                  .FilterSettings(filter => { filter.FilterType(FilterType.Excel).FilteredColumns(col => col.Field("Available").Operator(FilterOperatorType.Equals).Value("Enabled").Add()); })
                                                  .Columns(col =>
                                                      col.Field(x => x.IsVerify)
                                                      col.Field(x => x.Id)
                                                      col.Field(x => x.Code)
                                                                  + "{{:Code}}"
                                                                  + "
                                                        .ValidationRules(v => v.AddRule("required", true))
                                                      col.Field(x => x.Description)
                                                      col.Field(x => x.Handing)
                                                      col.Field(x => x.Range)
                                                      col.Field(x => x.Rule)
                                                      col.Field(x => x.Available)
                                              .HeaderText(" ")
                                              .Template(" View" +
                                              "Edit" +
                                              "Duplicate" +
                                              "{{if IsActive}}" +
                                              "Disable" +
                                              "{{else}}" +
                                              "Enable" +

And below is my C# code of the controller

        public ActionResult Search(DataManager dataManager)
            var products = _productsService.GetAllProducts().ToList();

            var data = ApplySearch(dataManager, products, out var count);

            return Json(new { result = data, count });

        public ActionResult Update(ProductRowViewModel model)
             HttpContext.Response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
            return Json(new { Success = false, Message = "Code must be unique!" }, JsonRequestBehavior.AllowGet);

All the properties in the model are coming null. however the model is perfect
I am using the URL Adapter.

3 Replies

VN Vignesh Natarajan Syncfusion Team November 16, 2018 11:47 AM UTC

Hi Sandip, 
Thanks for contacting Syncfusion support.  
From your query, we understand that you are facing issue while updating the record in server side. While updating the records you have tried to receive the parameters as model (public ActionResult Update(ProductRowViewModel model) in server side instead of Value, so it returns the object as null. In Grid, we have passed the updated parameters in the form of objects and in name of value.  
So we suggest you to follow as like below code example 
                              .Datasource(ds => ds.URL("/Grid/UrlDataSource").UpdateURL("/Grid/Update").InsertURL("/Grid/Insert").RemoveURL("/Grid/Delete") 
  public ActionResult Update(Orders value) 
            Orders val = order.Where(or => or.OrderID =value.OrderID).FirstOrDefault(); 
            val.OrderID = value.OrderID; 
            val.EmployeeID = value.EmployeeID; 
            val.CustomerID = value.CustomerID; 
            val.ShipCity = value.ShipCity; 
            return Json(value); 
Refer to the screenshot for the output 
For your convenience we have prepared a sample which can be downloaded from below link 
Please get back to us if you need any further assistance. 
Vignesh Natarajan 

SA Sandip November 19, 2018 12:23 AM UTC

Thanks. After applying its working for me.

VN Vignesh Natarajan Syncfusion Team November 19, 2018 08:23 AM UTC

Hi Sandip, 

Thanks for the update. 

We are glad to hear that your query has been resolved by your solution. 

Please get back to us if you have further queries. 

Vignesh Natarajan  

Live Chat Icon For mobile
Up arrow icon