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

Get Data Selected and send to controller in MVC

2 Answers 156 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Luz
Top achievements
Rank 1
Luz asked on 06 Dec 2013, 04:03 PM
How could I get the selected data of a kendo grid and send them to controller for being read? How could I get it with the corresponding ViewModel?

2 Answers, 1 is accepted

Sort by
0
Marcel
Top achievements
Rank 1
answered on 07 Dec 2013, 10:31 AM
You can get the selected items through the change event of the Grid.
change: function(e) {
  var selectedRows = this.select();
  var selectedDataItems = [];
  for (var i = 0; i < selectedRows.length; i++) {
    var dataItem = this.dataItem(selectedRows[i]);
    selectedDataItems.push(dataItem);
  }
  // selectedDataItems contains all selected data items
}

Then you can do whatever you want with them.
0
Vladimir Iliev
Telerik team
answered on 10 Dec 2013, 02:37 PM
Hi Luz,

As Marcel already mentioned you can use the "change" event of the grid to get the currently selected rows, get their dataItem and finally pass them to the controller for example using custom Ajax request

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
Luz
Top achievements
Rank 1
Answers by
Marcel
Top achievements
Rank 1
Vladimir Iliev
Telerik team
Share this question
or