
Thanks,
-Brian
5 Answers, 1 is accepted
Could you send us a small sample project that demonstrates this. It can be with some dummy data. We will take a look at it and see what is going on.
Meanwhile, you can try the same with Microsoft's DataPager. Does it behave in the same way or differently?
Thanks in advance.
Best wishes,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

The MS pager does the same thing, but I didn't expect it to work. I'm probably misunderstanding things, but I thought the Telerik pager could use non-paged sources, autowrapping them in a paged collection, whereas the MS pager could not.
Thanks,
-Brian
We have examined your project. It appears that the custom implementation of the DomainService is causing both RadDataPager and the MS DataPager to think that there are always more pages. They are confused about the count.
Let me explain what is the difference between non-paged source and paged source. Paged source is something that implements the IPagedCollectionView interface. In your sample project RadDataPager is bound to DomainDataSource.Data which is an IPagedCollectionView. In such cases, RadDataPger simply obeys what this interface is telling it. So you are in a paged source scenario.
A non-paged source is something that is not an IPagedCollectionView, such as an IEnumerable. Your case is not like that. My blog post explains this in great detail.
Since RadDataPager is bound to DomainDataSource.Data it is simply doing what the interface tells it. The custom implementation of the DomainService is not telling it what is the total item count, so the assumption is that it is infinite. That is why both RadDataPager and MS Data Pager have their next/last page buttons always enabled. They think that there is more data on the server.
To make your DomianService tell the pagers the total item count you will have to override its Count method and return the amount of data that is available.
For example:
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.ServiceModel.DomainServices.Hosting;
using
System.ServiceModel.DomainServices.Server;
using
ClassLibrary1;
namespace
DataPager_Test.Web.Services
{
[EnableClientAccess]
public
class
TestDomainService : DomainService
{
public
IQueryable<Class1> getQuery()
{
Class1 myClass =
new
Class1();
return
myClass.getQuery();
}
protected
override
int
Count<T>(IQueryable<T> query)
{
Class1 myClass =
new
Class1();
return
myClass.getQuery().Count();
}
}
}
This will correctly inform anyone that is bound to DomainDataSource.Data, which is an IPagedCollectionView, what is the total amount of data.
If you replace your custom DomainService with a "normal" one, i.e. one created like in tutorials targeting a real DB, then you will see how everything will start working correctly. When you go to the last page you cannot go further. You can see this on our online example Paging Configurator. Experiment with the IsTotalItemCountFixed check-box when you are on the last page. See what will happen.
Once again, I strongly recommend reading my extensive blog post about different paging scenarios. It explains it all.
To learn how to configure your custom Domain Service so that it plays nicely with the rest of the world, please read Nikhil Kothari's blog post. Here is a quote from the comments:
"@Alexandre
For returning total count information we take your query from a query method, compose any incoming query and then perform the equivalent of IQueryable.Count() operation by virtue of calling the Count<T> method on DomainService. You can override Count<T> to customize the counting."
Try this and see how it goes.
We hope that we were able to help. Let us know if you encounter any other problems along the way.
Regards,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.

Suppose you're consuming a WCF generic Search service that supports server paging by means of two parameters "Page Size" and "Page Number". A separated method, SearchInfo, can be called to retrieve the total number of pages for one particular Search criteria.
These methods are from an API, thus cannot be modified. Also, it makes it difficult to submit a working example.
What I've done: I have one ObservableCollection Results with the results of Search to which my GridView is bound to.
I have one "dummy" PagedCollectionView created based on SearchInfo. I attached to PageChanged event one method call that calls Search. In other words, when the Page changes, I call Search again, which updates Results and the grid.
Is this the correct approach?
What would be the best approach to implement paging in this scenario?
Thanks
Since I am not an authority, I can't really commit to what the most correct approach is.
How would you implement paging if you were using the stock DomainDataSource, the stock DataPager and the stock DataGrid provided by Microsoft?
What I would do is implement the IPagedCollectionView interface, since this gives me the freedom to "fake" page index and page count and trick all controls that respect that interface, in this case the MS DataPager/RadDataPager. In other words, I will be "pulling" my data from the server with the two parameters and then fake the paging through the IPagedCollectionView implementation. Implementing IPagedCollectionView is far from trivial though. For a reference implementation you can reflect Microsoft's PagedCollectionView class. All of this is beyond the scope of Telerik support.
I hope this helps.
Ross
the Telerik team