Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Remote Custom Paging With DataGrid and DataTable
posted

I am trying to implement a DataGrid with Custom Remote Paging.

I can not pass the value of the RecordCountKey, or I do not Know how to do it. This is part of my code:

On the Controller:

[GridDataSourceAction]
[HttpGet]
public ActionResult SearchTransferences(int SizePage, int NumberPage)
{

DataTable dtable = ... here I do my stuff

return View("Index", dtable);

}

On my view i have;


@(Html.Infragistics()
.Grid<DataTable>()
.ID("Grid")

...

...

feature.Paging()
.PageSize(10).Type(OpType.Remote)
.RecordCountKey("Data.TotalRows")

Parents
  • 29417
    Offline posted

    Hello Jose, 

    Thank you for posting in our forum. 

    When using the [GridDataSourceAction] attribute the remote operations will be handled out of the box.

    In the response json the data records will be wrapped in a Records object and the total record count will be set in a TotalRecordsCount object.

     Example json response from an action that has the [GridDataSourceAction] attribute applied to it:

    {"Records":[{ … }], TotalRecordsCount: 20}

     Those are also the default values set for the grid’s ResponseDataKey and the RecordCountKey when initializing the grid via the MVC wrappers.

     So you should either not set those options in order for them to take their default values or you should set them to “Records” and “TotalRecordsCount” in order to match their respective response json objects.

     I’ve attached a sample with a grid bound to a data table and remote paging for your reference.

    Please refer to it and let me know if you have any questions. 

    Best Regards,

    Maya Kirova

    Infragistics, Inc.

    http://www.infragistics.com/support

     

     

    Grid_table.zip
Reply Children