This is a migrated thread and some comments may be shown as answers.

Sending Multiple Models to the Grid via ActionResult

1 Answer 177 Views
Grid
This is a migrated thread and some comments may be shown as answers.
D_R
Top achievements
Rank 1
D_R asked on 22 May 2013, 05:25 PM
When Adding a model to my grid via a controller action, it is possible that there may be more than one model created as a result of the process.

Normally, when only one item is added, we are sending the created or updated Model back to the View by calling:            
return this.Json((new Model[] { singleModelRecord }).ToDataSourceResult(request, this.ModelState));
Where "singleModelRecord" is a single model.

However, in this case, I would like to be able to send a List of Models back to the client, and have all the rows added to the grid, instead of having just one of them added, and needing to refresh the grid to see the rest.  This is what I was trying, but only one new model was being shown in the grid:

return this.Json(arrayOfModels.ToDataSourceResult(request, this.ModelState));
where "arrayOfModels" is the array of Models that have just been created.

Is this functionality supported?

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 24 May 2013, 01:29 PM
Hi Daniel,

 
Basically this functionality currently is not supported out-of-the-box, however you can use the RequestEnd event of the DataSource to check if current type is "create" to refresh the Grid using the read method

Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
D_R
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or