1

I have a logical problem. Assume I have a table that includes 1000 rows. When I want to display the data in a repeater, I first bind CollectionPager 1000 rows, so CollectionPager knows how many pages there will be, and after that, CollectionPager will be my repeaters datasource.

If I index my table using Row_Number() property and select 10 records per time, and multiply it with my page_number, since its selecting 10 records only, its performance will be good. But at this time my pager does not know how many total records are there and so It does not make paging.

In the other hand I do not want to select all 1000 rows?

What do you offer me?

Thank you.

1 Answer 1

0

I would suggest to have one and the very first trip to database to just find out the count of total records that you will going to get, you can store it in the viewstate or hidden fields for further page post backs.

Then you can fetch 10 records per database trip and so you will always have

10 records from the database + Total records count that you can use for your pager

In this way your pager will always know the total number of records and hence will perform the paging accordingly

1
  • Thank you Pawan, this is what I am trying to do now. I will share the result with you as soon as possible. Again, thanks for your advice. Commented Jan 17, 2012 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.