This is a migrated thread and some comments may be shown as answers.

[Solved] Custom paging advice/tip needed

2 Answers 98 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Knut
Top achievements
Rank 1
Knut asked on 09 Oct 2009, 08:09 AM
Hello forum,
RadControl newbie looking for help:

I would like to build a grid custom paging function that returns a pagesize dependant on a datasource value - is this possible? The actual scenario I'm trying to accomplish is displaying a grid of tracks belonging to an album (trackcollection). If the album contains more than one CD, ideally, I'd like to page/show the tracks belonging to this particular CD only.

Each datasource row/griditem contains among other things cdNo and trackNo - if an album contains 4 CDs with 12, 14, 4, and 6 tracks respectively, the paging function should then result in 12 records on page1, 14 on page2 and so on.

Does anyone have something that could get me going in the right direction?

Thank you very much.
knut

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 09 Oct 2009, 10:32 AM
Hello Knut,

Telerik RadGrid allows fetching only a fixed number of records and perform operations over this specified set of data. The main steps you need to undertake are:
     Set AllowPaging = true and AllowCustomPaging = true for your grid instance
     Implement code logic which to extract merely a fixed number of records from the grid source and present them in the grid structure.
The example demonstrates the approach for custom paging depicted above: Custom Paging

Here is my idea to accomplish the functionality, Give a try with ths.
Get the CurrentPageIndex in NeedDataSource event and set the PageSize to number of tracks for that CD. Then create query to retrieve the track information based on cdNo and set the DataSource to display data.






-Shinu.
0
Knut
Top achievements
Rank 1
answered on 09 Oct 2009, 04:36 PM
Hello Shinu,

Thank you very much for your response & suggestion - I will try to work along those lines. I had a similar notion, but couldn't quite see where to get it started and your idea to use the needdatasource event seems good. Maybe even a combination of your suggestion and datasource filtering to return only the rows of each individual CD, using that count as the [dynamic] pagesize, turning paging on only in the event that the album is a multiCD collection.

With regards,
knut
Tags
Grid
Asked by
Knut
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Knut
Top achievements
Rank 1
Share this question
or