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

Send grid data to controller and initialize window with results

2 Answers 59 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bill Wingate
Top achievements
Rank 1
Bill Wingate asked on 02 Mar 2016, 07:47 PM

I have a Kendo Grid on the page. When the user clicks a button, I want to send the rows (data objects) from the grid to the controller. The controller will return a partial view, which will be used as the content for a new window. I've got the window load from a partial view working using .refresh({url:}), but I'm having trouble getting the grid data sent. Seems like I should be able to use something like this, but it's not working for me:

                    dialog.refresh({
                        url: "/Controller/Action",
                        data: JSON.stringify({items:$("#grid").data("kendoGrid").dataItems}),
                        dataType: "json",
                        type: "POST",
                        contentType: 'application/json; charset=utf-8'})

 

On the controller I have the items parameter defined as IEnumerable<Item> but it gets a null value.

2 Answers, 1 is accepted

Sort by
0
Accepted
Petyo
Telerik team
answered on 04 Mar 2016, 12:46 PM
Hi,

the grid does not host its data - its bound dataSource does. I may suggest that you retreive the data from there. The datasource has data and view methods for that purpose. 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Bill Wingate
Top achievements
Rank 1
answered on 11 Mar 2016, 11:23 PM
Sorry--missed the reply notification for this. Thank you for the help.
Tags
Grid
Asked by
Bill Wingate
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Bill Wingate
Top achievements
Rank 1
Share this question
or