views:

13

answers:

1

I'm tying to make a radgrid that sorts items like a bank statement. By this I mean it has to follow a specific pattern.

All the data is pulled in one linq statement and put into what is essentially a list.

Each page must have an ascending sort (by date dd-mm-yy) from top to bottom. This means we should see :

26/09/10 | item 1 | €9.00

27/09/10 | item 2 | €3.00

29/09/10 | item 3 | €12.00

12/10/10 | item 4 | €25.00

This is simple enough as I would just be setting the sorting order to ascending. My problem however lies in the following :

The bank statement will be laid out over a number of pages with 10 items per page. The pages must be sorted in DESCENDING order. This means the statements will look like this :

PAGE 3

13/10/10 | item 16 | €9.00

14/10/10 | item 17 | €3.00

15/10/10 | item 18 | €12.00

17/10/10 | item 19 | €25.00

18/10/10 | item 20 | €9.00

19/10/10 | item 21 | €3.00

21/10/10 | item 22 | €12.00

22/10/10 | item 23 | €25.00

24/10/10 | item 24 | €12.00

27/10/10 | item 25 | €25.00

PAGE 2

15/09/10 | item 06 | €9.00

16/09/10 | item 07 | €3.00

18/09/10 | item 08 | €12.00

01/10/10 | item 09 | €25.00

03/10/10 | item 10 | €9.00

07/10/10 | item 11 | €3.00

08/10/10 | item 12 | €12.00

12/10/10 | item 13 | €25.00

12/10/10 | item 14 | €12.00

12/10/10 | item 15 | €25.00

PAGE 1

09/09/10 | item 01 | €9.00

09/09/10 | item 02 | €3.00

10/09/10 | item 03 | €12.00

12/09/10 | item 04 | €25.00

14/09/10 | item 05 | €9.00

Also, the 1st visible page is page 3, so essentially, page 1 will be where it begins, and page 3 is where it ends, however, the highest number page is shown first.

My thinking is to break every 10th value off and seperate the data into lists of size 10. Then do my sorting on them. I have a feeling that this could get quite messy given a large volume of data.

Another idea of mine is to sort them by placing the values at the end of the list first (i'm not sure about the implementation of this though)

Has anyone ever worked with something similar before and could they steer me in the right direction please?

Thanks

A: 

You could do your normal LINQ query to fetch records in batches of 'n' in normal date ascending order and then set the radgrid to sort the date in descending order so it effectively does the reverse sort for you. You need to configure the radgrid to tell it that you are doing the pagination.

Phil Bennett