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

Binding to QueryableDataServiceCollectionView not working

1 Answer 101 Views
DataServiceDataSource
This is a migrated thread and some comments may be shown as answers.
DMC Helpdesk
Top achievements
Rank 1
DMC Helpdesk asked on 31 Jul 2012, 02:30 PM
Hi,

I am trying to use QueryableDataServiceCollectionView in my Prism based application.My view model is working fine when binding to DataServiceCollection or DataServiceQuery ,but now I want to gain more control over paging,filtering,sorting,and saving data,so I switched to QueryableDataServiceCollectionView.I changed my view model binding property "DataItems" from DataServiceCollection<T> to  QueryableDataServiceCollectionView<T> and now I see the whole data records returned though the pagesize on my QueryableDataServiceCollectionView and on my DataPager is 20.

The grid display 41 records in page 1 and 3 paging buttons [1 2 3].The paging becomes normal (20 records per page) once I click on page1, page 2, or page 3.I checked fiddler and found that the data service query for the first loading lacks the '$top=20' parameter

view.ViewModel.DataItem = new Telerik.Windows.Data.QueryableDataServiceCollectionView<User>(db, db.Users){  AutoLoad = true,PageSize=20};


<telerik:RadGridView    ItemsSource="{Binding PagedSource, ElementName=DataPager1}"  >

<telerik:RadDataPager  Name="DataPager1" Source="{Binding DataItem}"   PageSize="20" DisplayMode="Numeric">


Environment:
VS 2010
.NET 4 + WCF
EF 4
Telerik WPF  2012_2_0725 Trial Version


Thanks in advance

1 Answer, 1 is accepted

Sort by
0
DMC Helpdesk
Top achievements
Rank 1
answered on 31 Jul 2012, 09:12 PM
The solution is to set page size outside the constructor,otherwise it gets ignored.

view.ViewModel.DataItem = new Telerik.Windows.Data.QueryableDataServiceCollectionView<User>(db, db.Users);
 view.ViewModel.DataItem.PageSize = 20;
view.ViewModel.DataItem.AutoLoad = true;

Tags
DataServiceDataSource
Asked by
DMC Helpdesk
Top achievements
Rank 1
Answers by
DMC Helpdesk
Top achievements
Rank 1
Share this question
or