We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Specifying the total record count

Hello.

I'm doing an example and I work with a database with 700.000 results. Obviously I don't return them all, just return the results of the current page.

My question is, as I'm doing that is only showing a total count as the total results of that page (for pagesize 20 the total result is 20).

I can't create a full list with the 700.000 elements, just want to return 20 but specify somehow that there are 700.000 so it makes the paging.

Thanks.

7 Replies

AR Ajith R Syncfusion Team July 8, 2013 01:11 PM UTC

Hi Guillermo,

 

Thanks for using Syncfusion products.

 

Query: Specifying the total record count?

 

To achieve your requirement, we suggest you to use custom binding feature of grid, for specifying the total record count in essential  grid. Please refer the below code snippet for further details.

Configure the grid to use custom binding with the EnableOnDemand() method.

@(Html.Syncfusion().Grid<Order>("OrdersGrid")

            .Datasource(Model)

            .Caption("Orders")

            .EnableOnDemand()

    )

 If the paging feature is enabled, you need to set TotalRecordCount. This field is required to display the grid pager properly.

@(Html.Syncfusion().Grid<Order>("OrdersGrid")

            .Datasource(Model)

            .Caption("Orders")

            .EnableOnDemand()

            .TotalRecordCount(200)

 )

 

 

 Please refer the below link to know further details about custom binding features.

 

http://mvc.syncfusion.com/demos/ui/grid/DataBinding/CustomBinding

 

For your convenience we have attached a sample for the above scenario. Please refer the below link to download it.

 

Please let us know if you have any concerns.

 

Regards,

 

Ajith R



OnDemandPaging_404ea84e.zip


GU Guillermo July 8, 2013 02:46 PM UTC

Will it work with ActionMode.JSON? because I'm getting 0 as total count (even if 20 elements are displayed).


GU Guillermo July 8, 2013 02:50 PM UTC

Nevermind, thank you for your help:

ActionResult result = balList.GridJSONActions<PX_Ballots2>(total);

That line with the EnableOnDemand() worked properly.


AR Ajith R Syncfusion Team July 9, 2013 08:56 AM UTC

Hi Guillermo,

Thanks for your update. We are glad to know that your issue has been resolved. Please let us know if you have any other concerns so that we will be happy to help you out.

Regards,

Ajith R



RM Razgovorov Mikhail August 13, 2016 08:06 AM UTC

is it possible to use a paging without total number of records (records a lot, and the total amount does not matter), the main thing is to be available to the next page without going to the end.
usual in such cases is requested for a single entry is more than I show to find out there is or not.


RM Razgovorov Mikhail replied to Razgovorov Mikhail August 13, 2016 09:06 AM UTC

is it possible to use a paging without total number of records (records a lot, and the total amount does not matter), the main thing is to be available to the next page without going to the end.
usual in such cases is requested for a single entry is more than I show to find out there is or not.

I understood. I made using a template


IR Isuriya Rajan Syncfusion Team August 16, 2016 09:36 AM UTC

Hi Razgovorov 
 
Thanks for the update. 
Please get back to us if you need further assistance on this. 
 
 
 
Regards, 
Isuriya R. 


Loader.
Up arrow icon