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

Service-oriented DataPager without WFC RIA

6 Answers 70 Views
DataPager
This is a migrated thread and some comments may be shown as answers.
Lars
Top achievements
Rank 1
Lars asked on 22 Dec 2010, 01:43 PM
How would you go about making serverside paging, without using the WFC RIA architecture?
We have an existing project, where we want to use RadGridView and RadDataPager, instead of the current standard gridview and pager,
and i have played around a bit with some ideas to make "custom" serverside paging. I can't get it to work.

Do you have any pointers on where to start? And is this supported "out of the box" in the RadDataPager, if so, where should i be looking?

E.g. 20 items per page, 200 items in all:
My own solution, which is not working, is to get 20 items from the service, and also get the total item count. Then i calculate how many items, depending on the pageindex, there are before and after the current page of 20 items, and add 'N' number of bogus item as fillers, to let the DataPager calculate number of pages total. E.g. pageindex = 3 (page 4) i would have 60 bogus items at the start of the source collection, the the 20 'real' items, and after these i would have 120 more bogus items.

But when i update the Source collection of the datapager and gridview, its seems to reset its pageindex. Im listening on the DataPagers PageIndexChanging event, and update the source collection during this event.

Looking forward to some feedback.

Regard,
Lars Udengaard

6 Answers, 1 is accepted

Sort by
0
Accepted
Rossen Hristov
Telerik team
answered on 22 Dec 2010, 02:48 PM
Hello Lars,

The bogus items are not longer needed since the pager has a feature called Unbound Mode.

I would do the following:

1. Use RadDataPager in UnboundMode. That means that it will not have its Source property defined. When in Unbound Mode, you can tell the pager the total number of items by setting its ItemCount property. It will then do the math according to the ItemCount and PageSize and update its UI.

2. Then attach to the PageIndexChanged event. You will receive the page index that the user is requesting.

3. Fetch the respective page data from your service and as soon as it arrives on the client -- set it as the ItemsSource of RadGridView.

In fact RadGridView will never have a clue what is really going on and that there is server-side paging.

As for RadDataPager, you will be using this control solely for its UI. Its built-in paging capabilities will not be used since it will be in Unbound Mode, i.e. Source = null.

Let me know if there are problems.

Regards,
Ross
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Lars
Top achievements
Rank 1
answered on 22 Dec 2010, 02:54 PM
That was exactly the kind of nifty feature i was looking for.
Thank you for the quick response, and good products.

Regards,
Lars
0
Lars
Top achievements
Rank 1
answered on 22 Dec 2010, 03:31 PM
Im using MVVM and tt doesnt look like you can bind ItemsCount, is this correct? Do you have to set it in codebehind?

/Lars
0
Rossen Hristov
Telerik team
answered on 22 Dec 2010, 03:42 PM
Hi Lars,

This is an issue that we are currently working on. You can vote for and follow its status here.

Until we resolve the issue you should set the ItemCount in code-behind.

Greetings,
Ross
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Lars
Top achievements
Rank 1
answered on 22 Dec 2010, 03:44 PM
Ok, Thanks! Happy holidays ;-)
0
Rossen Hristov
Telerik team
answered on 23 Dec 2010, 10:40 AM
Hello Lars,

I have fixed the ItemCount Binding and it will work as expected when we release the next "Latest Internal Build". It will not be able to make it for the SP coming out this week since we have already frozen the source code for this release.

Kind regards,
Ross
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
DataPager
Asked by
Lars
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Lars
Top achievements
Rank 1
Share this question
or