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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Properties on object passed to Save and Insert actions are NULL

Thread ID:





112416 Sep 20,2013 08:31 PM UTC Sep 25,2013 09:07 AM UTC ASP.NET MVC (Classic) 1
Tags: Grid
Dan Guisinger
Asked On September 20, 2013 08:31 PM UTC

I for the life of me can't figure out the problem.

I've got 3 grid controls, all are having the same behavior.
The object that is passed to the Insert or Save action appears to be an instance of an object, but all of the properties are null.  Its impossible to put information into the repository if it all comes across as NULL....

Here is the Grid definition:
                    .EnablePaging()    /*Paging Enabled*/
                                /*.Grouping( group => group.GroupDescriptors(grouped => grouped.Add(c=>c.VIN)).IsExpanded(true))    Grouping Enabled for VIN */
                    .Column(cols =>
                        cols.Add(c => c.VIN).HeaderText("VIN").TextAlign(Syncfusion.Mvc.Grid.TextAlignment.Right).Width(130);
                        cols.Add(c => c.Type).HeaderText("Type").TextAlign(Syncfusion.Mvc.Grid.TextAlignment.Right).Width(200).CellEditType(CellEditType.DropdownEdit);
                        cols.Add(c => c.Make).HeaderText("Make").TextAlign(Syncfusion.Mvc.Grid.TextAlignment.Right).Width(130);
                        cols.Add(c => c.Model).HeaderText("Model").TextAlign(Syncfusion.Mvc.Grid.TextAlignment.Right).Width(130);
                        cols.Add(c => c.Year).HeaderText("Year").TextAlign(Syncfusion.Mvc.Grid.TextAlignment.Right).Width(100);
                        cols.Add(c => c.Color).HeaderText("Color").TextAlign(Syncfusion.Mvc.Grid.TextAlignment.Right).Width(100);
                        cols.Add(c => c.LicensePlate).HeaderText("Plate").TextAlign(Syncfusion.Mvc.Grid.TextAlignment.Right).Width(100);
                        cols.Add(c => c.Odometer).HeaderText("Odometer").TextAlign(Syncfusion.Mvc.Grid.TextAlignment.Right).Width(100).CellEditType(CellEditType.NumericEdit);
                    .ClientSideEvents(events => { events.OnCellEdit("SetDropDownData"); })
                    .Mappers(mapper => { mapper.InsertAction("AddVehicle").SaveAction("SaveVehicle").DeleteAction("DeleteVehicle").Action("Vehicle"); })
                    .Editing(edit => { edit.AllowEdit(true).AllowNew(true).AllowDelete(true); edit.EditMode(GridEditMode.AutoExcel); edit.AddNewRowPosition(RowPosition.Bottom); edit.PrimaryKey(key => key.Add(p => p.VIN)); })
                    .ToolBar(tools => { tools.Add(GridToolBarItems.AddNew).Add(GridToolBarItems.Edit).Add(GridToolBarItems.Delete).Add(GridToolBarItems.Update).Add(GridToolBarItems.Cancel); })

and here is the code from the controller:
 #region Vehicle Grid

        public ActionResult Vehicle(PagingParams args)
            IEnumerable data = Models.VehicleRepository.GetAllRecords();
            return data.GridJSONActions<Vehicle>();


        public ActionResult AddVehicle(Vehicle veh)
            var data = Models.VehicleRepository.GetAllRecords();
            return data.GridJSONActions<Vehicle>();

        public ActionResult SaveVehicle(Vehicle veh)
            var data = Models.VehicleRepository.GetAllRecords();
            return data.GridJSONActions<Vehicle>();

        public ActionResult DeleteVehicle(string VIN)
            if (ModelState.IsValid)
            var data = Models.VehicleRepository.GetAllRecords();
            return data.GridJSONActions<Vehicle>();

        #endregion Vehicle Grid

Vehicle is defined as:
public class Vehicle
        [Display(Name = "Year")]
        public int Year { get; set; }
        [Display(Name = "Make")]
        public string Make { get; set; }
        [Display(Name = "Model")]
        public string Model { get; set; }
        [Display(Name = "VIN")]
        public string VIN { get; set; }
        [Display(Name = "License Plate")]
        public string LicensePlate { get; set; }
        [Display(Name = "Color")]
        public string Color { get; set; }
        [Display(Name = "Odometer")]
        public int Odometer { get; set; }
        [Display(Name = "Membership Type")]
        public string Type { get; set; }

When SaveVehicle or AddVehicle is called, the veh object is valid, but all of the data (Year, Make, Model, VIN, etc) are all NULL.

Any ideas?
I've wasted hours on trying to figure out this nonsense.

Hariharan J V [Syncfusion]
Replied On September 25, 2013 09:07 AM UTC

Hi Dan Guisinger,

Thanks for using Syncfusion products.

We suggest you to use BulkSave method for add, delete and update the records in the excel edit mode. Please refer the below code snippets.

        public ActionResult BulkSave([Bind(Prefix = "updatedRecords")]IEnumerable<EditableOrder> orders, [Bind(Prefix = "addedRecords")]IEnumerable<EditableOrder> addRcrds, [Bind(Prefix = "deletedRecords")]IEnumerable<EditableOrder> delRcrds)
            if (orders != null)
            if (addRcrds != null)
            if (delRcrds != null)
            var data = OrderRepository.GetAllRecords();
            return data.GridJSONActions<EditableOrder>();

For your convenience, we have prepared a simple sample to demonstrate this and the same can be downloaded from the below link.

Sample: www.syncfusion.com/downloads/support/directtrac/general/Exceledit1404297500.zip

Please let us know if you need any further assistance.

Hariharan J.V.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon