5 Answers, 1 is accepted
I have implemented a RadGridView using RiaServices with DomainService.
My code is pretty much similar to the online demo.
I am able to get data from my domainservice, and to use the paging, but I have teh following problem:
the pager dpesn't show the total number of pages, and the filtering is applied ONLY to the displayed page data, and not on the entire set of data.
Am I doing something wrong? Here is my code
<riaControls:DomainDataSource x:Name="_contactDomainDataSource" AutoLoad="True" QueryName="GetCustomers"
LoadingData="ContactDomainDataSource_LoadingData" LoadedData="ContactDomainDataSource_LoadedData">
<riaControls:DomainDataSource.DomainContext>
<domainService:ContactContext/>
</riaControls:DomainDataSource.DomainContext>
<riaControls:DomainDataSource.FilterDescriptors>
<riaData:FilterDescriptorCollection LogicalOperator="Or" />
</riaControls:DomainDataSource.FilterDescriptors>
</riaControls:DomainDataSource>
<telerik:RadGridView x:Name="_contactsGrid"
Grid.Row="0"
AutoGenerateColumns="False"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Background="Transparent"
BorderThickness="0"
GridLinesVisibility="Horizontal"
ItemsSource="{Binding Data, ElementName=_contactDomainDataSource}"
Filtering="RadGridView1_Filtering"
>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn UniqueName="Email" Header="Email" Width="*"/>
<telerik:GridViewDataColumn UniqueName="Phone1" Width="*" Header="Phone(SMS)"/>
<telerik:GridViewDataColumn UniqueName="Company" Width="*" Header="Company" />
<telerik:GridViewDataColumn UniqueName="GivenName" Width="*" Header="Givenname" />
<telerik:GridViewDataColumn UniqueName="SurName" Width="*" Header="Surname" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
<data:DataPager x:Name="DataPager1" Grid.Row="1" PageSize="10" Source="{Binding Data, ElementName=_contactDomainDataSource}"/>
Filtering by default will be applied only on loaded data (current page) - you can check the example to know more about how to apply the grid filtering to the DomainDataSource. Can you provide more info about your context type? Generally only LINQ to SQL context have support for total number of pages - no such in Entity Framework.
Regards,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
[EnableClientAccess()]
public class ContactService : DomainService
{
public IQueryable<Data.Contact> GetContacts()
{
var membershipUser = Membership.GetUser();
var user = UserLocator.Instance.FindByEmail(membershipUser.Email);
var contactDatabase = user.ContactDataDatabases.FirstOrDefault();
return (from c in contactDatabase.Get(0, int.MaxValue) select c as Data.Contact).AsQueryable();
}
}
I'm not sure why DataPager control is not populated properly in your case however I'll gladly help you if you can send us small example (via support ticket) where this issue can be reproduced.
Kind regards,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.