Send grid data to controller and initialize window with results

3 posts, 1 answers
  1. Bill Wingate
    Bill Wingate avatar
    12 posts
    Member since:
    Feb 2009

    Posted 02 Mar 2016 Link to this post

    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. Answer
    Petyo
    Admin
    Petyo avatar
    2444 posts

    Posted 04 Mar 2016 Link to this post

    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!
     
  3. Bill Wingate
    Bill Wingate avatar
    12 posts
    Member since:
    Feb 2009

    Posted 11 Mar 2016 in reply to Petyo Link to this post

    Sorry--missed the reply notification for this. Thank you for the help.
Back to Top