Using the latest version of IgniteUi.
I'm using iGrids saveChanges ajax functionality to httppost transactions to an mvc controller.
As per documentation and examples the return type of the controller is "ActionResult" however the return is a Json response.
On its way out when the code reaches the OnActionExecuted I get an error inside the GridDataSourceActionAttribute class on line 146 - Object reference not set to an instance of an object.
Here are some snippets of code.
My success response being returned from the controller with the Action Attribute.
JsonResult result = new JsonResult(); Dictionary response = new Dictionary(); response.Add("Success", true); result.Data = response; return result;
The setup of my iGrid
@(Html.Infragistics() .Grid() .ID("MoviesGrid") .PrimaryKey("ID") .AutoCommit(true) .RenderCheckboxes(false) .Features(features => { features.Sorting().Type(OpType.Local).Mode(SortingMode.Single); features.Updating(); features.Filtering(); }) .DataSource(Model.Movies) .DataSourceUrl(Url.Action("GetMoviesDataAction", "Movies")) .UpdateUrl(Url.Action("UpdateMovieRecords")) .AggregateTransactions(true) .DataBind() .Render())
Hello Jagdip Singh,
Thank you for posting in our forums!
I am able to reproduce the exception and am discussing this further with the grid's development team for their input.
I will have more information for you when I hear back from them. If you have any further questions or concerns with this issue, please let me know.
Hi Jagdip Singh,
For the saveChanges actions, the GridDataSourceActionAttribute should not be used. The GridDataSourceActionAttribute is meant to take the model data and convert it to JSON in the response for the igGrid to bind to. The igGrid is not expecting to receive new data when saveChanges is called. You can find an example of using a saveChanges action in our documentation here.
If you need to refresh the grid's data after calling saveChanges, it is recommended to make a separate dataBind call on the grid.
If you have any further questions or concerns with this, please let me know and I will be glad to help.