RadDatapager displays just one page

17 posts, 0 answers
  1. EDGAR JIMENEZ
    EDGAR JIMENEZ avatar
    8 posts
    Member since:
    Apr 2010

    Posted 17 Mar 2011 Link to this post

     

     

     

     

     

     

     

    <telerik:RadDomainDataSource x:Name="messageLogDataSource" AutoLoad="True" QueryName="GetMessageLogs" PageSize="10">  
      
    <telerik:RadDomainDataSource.DomainContext
      
     <DomainServices:LoggingDataContext/> 
      
     </telerik:RadDomainDataSource.DomainContext
      
     </telerik:RadDomainDataSource
      
      
    <telerik:RadGridView x:Name="radMessageLogGridView" VerticalAlignment="Top" Grid.Row="0" RowStyleSelector="{StaticResource messageLevelStyle}" ItemsSource="{Binding DataView, ElementName=messageLogDataSource}" IsReadOnly="True"/>
      
       
      
      
       
     <telerik:RadDataPager x:Name="radDataPager" Grid.Row="1" VerticalAlignment="Bottom" 
      
      
    Source="{Binding DataView, ElementName=messageLogDataSource}" DisplayMode="All" IsTotalItemCountFixed
      
    ="True"/>

     

    The query GetMessageLogs looks like this: 

     

     

     

     

     

     

    public IQueryable<MessageLog> GetMessageLogs() 
      {
         
     var list = DataContainerService.GetMessageLogEntities();  
      
     var returnList = list.Select(e => new MessageLog 
      
    (e)).ToList().AsQueryable().OrderBy((x=>x.Mlid));  
    return returnList;
    }

     

     

     

     

     

     

    The returnList here contains 90 entries, the radgridview displays 10, therefore, the pager should give me 9 pages. But, it gives me only one.

    Could you help me and see what can be the problem? 

     

  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 18 Mar 2011 Link to this post

    Hello EDGAR JIMENEZ,

    We have tried to reproduce this behavior, but unfortunately we could not. Can you please prepare a small dummy sample project, open a separate support ticket and attach it there.  

    We will debug it in order to see why is this happening.

    Alternatively, if that would be more convenient for you, I have attached a small sample project which you can try to modify in order to make it exhibit the behavior that you are faced with in your original project. In my sample project the pager works correctly.

    Thanks in advance. We are looking forward to hearing from you.

    Regards,
    Ross
    the Telerik team
  3. DevCraft banner
  4. EDGAR JIMENEZ
    EDGAR JIMENEZ avatar
    8 posts
    Member since:
    Apr 2010

    Posted 18 Mar 2011 Link to this post

    Hi Ross,

    I essentially followed the same thinking as in the project you have attached. Still, I am not getting the pager to work.

    One thing I noticed though is that, I use DomainService (System.ServiceModel.DomainServices.Server) as the base class to my service class whereas you use LinqtoEntitiesDomainService<T> (System.ServiceModel.DomainServices.EntityFramework). Do you think this would make any difference?
  5. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 18 Mar 2011 Link to this post

    Hello EDGAR JIMENEZ,

    I really don't think that this should matter. But I am not 100% sure.

    Let's see what else we can try...

    If you attach to the LoadedData event of RadDomainDataSource (like in my sample project where I print some debugging information), what is the value of e.TotalEntityCount? This is the count that the pager will do its math with. It is very important.

    By the way, could you do a very quick experiment. Can you replace RadDataPager with the MS DataPager and RadDomainDataSource with the MS DomainDataSource. They have the same API'sm so this should be easy. After you do this, is the result the same, i.e. is the MS pager behaving in the same way? In case it is this would most probably mean that we have to search for the issue on the server-side code.

    If none of that helps, I would ask you to please prepare a small dummy sample project that demonstrates this behavior, open a separate support ticket and attach it there.

    We will debug it and try to see what is going on.

    Thanks in advance.

    Regards,
    Ross
    the Telerik team
  6. EDGAR JIMENEZ
    EDGAR JIMENEZ avatar
    8 posts
    Member since:
    Apr 2010

    Posted 18 Mar 2011 Link to this post

    Hi Ross,

    My totalentitycount is returning as -1. But, my service returns all entities. I think somewhere the count is not set.
    I suppose MS DomainDataSource and MS Datapager will behave the same way because of this count.

    Are you setting the count anywhere in your example or is it automatically provided by LinqtoEntities<T>?
  7. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 18 Mar 2011 Link to this post

    Hi EDGAR JIMENEZ,

    The TotalEntityCount is provided by WCF RIA Services and is crucial for all calculations when there is paging.

    I have no idea why your service will not return it. We automatically set the IncludeTotalCount property of the EntityQuery<T> before we send it to the server.

    Your best shot would be to remove all Telerik controls for a while and use only a plain simple DomainContext and an EntityQuery. Prepare your EntityQuery<T>, turn its IncludeTotalCount property on and tell the domain context to load it. When the items return from the server, check whether they will carry the total item count with them. Or will it be -1.

    In case there is still no TotalEntityCount returned, please post this problem on the WCF RIA Services forum, since it is really going out of Telerik's domain, since we have not control over WCF RIA Services.

    I hope this helps.

    Regards,

    Ross
    the Telerik team
  8. Naresh
    Naresh avatar
    31 posts
    Member since:
    Mar 2009

    Posted 21 Mar 2011 Link to this post

    Hello,

    We are now experiencing this same exact issue in our production environment using RadGridView + QueryableDomainServiceCollectionView + RadDataPager.
    
    
    Paging is fine in both our development and our staging environments. In production it is only showing 1 page even though there are multiple pages of data. It is consistent across all of our grids.

    The only difference that we can think of between our environments is the operating system. Our development environments are Windows XP Professional, our staging is Windows Server 2003 and production is Windows Server 2008. 

    I have tried overriding the Count<T> method but that did not make any difference.

    Any suggestions would be appreciated. This system goes online 3/31 so we are under a time crunch.

    UPDATE: We just found another difference. Our staging environment has the RC version of WCF RIA installed while production is running V1.0 SP1. My guess is there's a breaking change in v1.0 SP1 that is causing this behavior.

    Thank you,
    Brian
  9. DIETER
    DIETER avatar
    3 posts
    Member since:
    Oct 2010

    Posted 22 Mar 2011 Link to this post

    Hi,

    I have just tried the new features of the RadDomainDatasource and I have also this problem.
    I have set a PageSize of 5 in the RadDomainDatasource and I have bound the RadGridView and the RadPager to the DataView of the RadDomainDataSource.
    On the first load, it seems that the result is calculated correctly. That means that the RadPager shows 3 available pages and the RadGridView shows me 5 items.
    When I choose the second page in the Pager the GridView is empty and the pager displays only one page. So it seems that the GridView and the pager looses their Itemssource as soon as I navigate with the pager.
  10. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 22 Mar 2011 Link to this post

    Hi,

    It is quite possible that there is some kind of breaking change, even though I seriously doubt this.

    For your reference, I have attached a sample project that works correctly on my development machine, which is currently running WCF RIA Services V1.0 SP1 (the one that comes with VS2010 SP1). Here is a short movie of what I am seeing when I run the sample project.

    Meanwhile, has anyone tried to do absolutely the same thing with the MS DomainDataSource, the MS DataGrid, and the MS DataPager? In other words, if you loose all Telerik controls, is the result the same or different? This is very important for our investigation.

    Please, post your findings here.

    All the best,

    Ross
    the Telerik team
  11. DIETER
    DIETER avatar
    3 posts
    Member since:
    Oct 2010

    Posted 24 Mar 2011 Link to this post

    Hi,

    I found the problem. (I think it's the same one for the other here)

    When you create a new project and you add the edmx-Model and the DomainService there is by default no OrderBy-Statement on the Get-Methods.
    If this is missing you get the following error when you try to use the DataPager:

    01:49:47.856: Server returned the following error: System.ServiceModel.DomainServices.Client.DomainOperationException: Load operation failed for query 'GetDienstleistungstypen'. The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'.

    So that's the problem. You just have to add a OrderBy Statement to the different Get-Methods in your DomainService and then it should work.

    Kind regards
    Michael
  12. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 24 Mar 2011 Link to this post

    Hi DIETER,

    Oh, the famous Entity Framework issue. I totally forgot about it. 

    All the best,
    Ross
    the Telerik team
  13. Naresh
    Naresh avatar
    31 posts
    Member since:
    Mar 2009

    Posted 28 Mar 2011 Link to this post

    Hi Ross,

    I'm still facing this problem. Paging is fine on my development box but not on our development or production server. I just created a test app using both MS controls and Telerik's controls. Paging works with the MS controls on both my box and on both of the servers. Paging does not work with the Telerik controls.

    I have insert the code below and have attached three screen shots. The first screen shot shows the two grids as they appear when the first load (all's well). The second screen shot shows what happens when you navigate to page 2. As you will see, both grids load page two correctly but the RadDataPager now shows only page 1 and "2 of 1". The MS data pager is OK. The third screen shot shows that the MS will navigate to page 3 while the Telerik pager will not.

    <Grid x:Name="grdMain">
        <Grid.ColumnDefinitions>
            <ColumnDefinition></ColumnDefinition>
            <ColumnDefinition></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
     
     
    <StackPanel Orientation="Vertical"
                Grid.Row="0" Grid.Column="0">
        <riaControls:DomainDataSource AutoLoad="True"
                                      Height="0"
                                      Name="partnerDomainDataSource"
                                      QueryName="GetPartnersQuery"
                                      Width="0">
            <riaControls:DomainDataSource.DomainContext>
                <my:TestDomainContext />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
        <sdk:DataGrid AutoGenerateColumns="True"
                      ItemsSource="{Binding ElementName=partnerDomainDataSource, Path=Data}"
                      Name="partnerDataGrid">
        </sdk:DataGrid>
        <sdk:DataPager Height="38"
                       Name="dataPager1"
                       PageSize="10"
                       Width="231"
                       DisplayMode="FirstLastPreviousNextNumeric"
                       Source="{Binding ElementName=partnerDomainDataSource, Path=Data}"/>
    </StackPanel>
     
     
    <StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="1">
            <telerik:RadDomainDataSource AutoLoad="True"
                                         Height="0"
                                         x:Name="rpartnerDomainDataSource"
                                         QueryName="GetPartnersQuery"
                                         Width="0">
                <telerik:RadDomainDataSource.DomainContext>
                    <my:TestDomainContext></my:TestDomainContext>
                </telerik:RadDomainDataSource.DomainContext>
            </telerik:RadDomainDataSource>
     
            <telerik:RadGridView ItemsSource="{Binding PagedSource, ElementName=radDataPager}"
                                 AutoGenerateColumns="True"
                                 Height="350"/>
     
            <telerik:RadDataPager x:Name="radDataPager"
                                  Source="{Binding ElementName=rpartnerDomainDataSource, Path=DataView}"
                                  PageSize="10"
                                  DisplayMode="All" />
    </StackPanel>
     
    </Grid>
  14. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 29 Mar 2011 Link to this post

    Hi Brian,

    I would very much like to help you, but unfortunately I will need a sample project which reproduces this behavior in order to debug it. Without having anything to debug, I cannot guess why is this happening on your production server and it is not happening on your development machine.

    Since only you have access to the project that reproduces this, you can try to debug it as well. You can check what is the amount of entities returned by the server. RadDataPager does nothing very special -- it simply divides the amount of items (entities) by the page size in order to calculate the total amount of pages.

    You can also try to do the following combinations:

    1. On the RadGridView-RadDomainDataSource-RadDataPager combination: replace RadDataPager with the MS DataPager.
    2. On the RadGridView-RadDomainDataSource-RadDataPager combination: replace RadDomainDataSource with the MS DomainDataSource.

    These can help us identify what control is causing this weird behavior.

    Also, can you try binding RadGridView to RadDomainDataSource instead of binding it to the PagedSource of RadDataPager. We are trying to make the Telerik and MS parts of the project as similar as possible.

    I cannot currently think of anything else I can suggest without having anything to actually debug.

    I hope this helps.

    Greetings,
    Ross
    the Telerik team
  15. Sami
    Sami avatar
    12 posts
    Member since:
    Feb 2011

    Posted 07 Apr 2011 Link to this post

    Hi:
    We are developing an application with Windows 7 with RadDataView and RadDataPagers. It works fine on Windows 7 on development ambient with visual studio,  but when we deploy the application to a Windows 2008 Server R2 (Spanish) based on IIS the raddatapager only shows one page since we have a lot of pages.
    We test it win IE 8 and with google Chrome in the same server an the problem is the same.




    Thanks in advance.
    Here is my XAML code:


    <UserControl x:Class="c3.Views.Evaluaciones.ListaEvaluadosUserControl"
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                     xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                     mc:Ignorable="d"
                     xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                     d:DesignWidth="797"
                     d:DesignHeight="480"
                     xmlns:c3Controles="clr-namespace:c3.Controls"
                     xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
                     xmlns:my="clr-namespace:c3.Web.Services"
                     xmlns:my1="clr-namespace:c3.Web.Models"
                     xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
                     xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit">
        <Grid x:Name="LayoutRoot">
            <c3Controles:BusyIndicator x:Name="busyGeneral"
                                       BusyContent="Cargando evaluados..."
                                       HorizontalAlignment="Stretch"
                                       VerticalAlignment="Stretch"
                                       IsBusy="{Binding ElementName=evaluadoDomainDataSource, Path=IsBusy}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30" />
                        <RowDefinition Height="450*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>












                    <telerik:RadDomainDataSource AutoLoad="True"
                                                 Height="0"
                                                 LoadedData="evaluadoDomainDataSource_LoadedData"
                                                 Name="evaluadoDomainDataSource"
                                                 QueryName="GetEvaluadoQuery"
                                                 Width="0"
                                                 DomainContext="{StaticResource EvaluacionesDomainContext}">
                       
                    </telerik:RadDomainDataSource>




                    <telerik:RadToolBar GripVisibility="Visible"
                                        Height="30"
                                        Grid.Row="0"
                                        HorizontalAlignment="Stretch"
                                        IsHitTestVisible="True"
                                        IsOverflowOpen="False"
                                        IsTabStop="False"
                                        Name="mainToolBar"
                                        VerticalAlignment="Top">
                        <telerik:RadMenu Background="{x:Null}"
                                         ClickToOpen="False"
                                         HorizontalAlignment="Left"
                                         ItemClick="OnRadMenuItemClick"
                                         Name="radMenu"
                                         Opacity="1"
                                         VerticalAlignment="Top">
                            <telerik:RadMenuItem Header="Archivo"
                                                 Height="30">
                                <telerik:RadMenuItem Header="Agregar">
                                    <telerik:RadMenuItem.Icon>
                                        <Image Source="/c3;component/Assets/Imagenes/ToolBar/Images/NewDocument.png"
                                               Stretch="None" />
                                    </telerik:RadMenuItem.Icon>
                                </telerik:RadMenuItem>
                                <telerik:RadMenuItem Header="Editar">
                                    <telerik:RadMenuItem.Icon>
                                        <Image Height="16"
                                               Width="16"
                                               Source="/c3;component/Assets/Imagenes/editar.png"
                                               Stretch="Fill" />
                                    </telerik:RadMenuItem.Icon>
                                </telerik:RadMenuItem>
                                <telerik:RadMenuItem Header="Eliminar">
                                    <telerik:RadMenuItem.Icon>
                                        <Image Source="/c3;component/Assets/Imagenes/ToolBar/Images/DelControl.png"
                                               Stretch="None" />
                                    </telerik:RadMenuItem.Icon>
                                </telerik:RadMenuItem>
                                <telerik:RadMenuItem Header="Consultar">
                                    <telerik:RadMenuItem.Icon>
                                        <Image Height="16"
                                               Width="16"
                                               Source="/c3;component/Assets/Imagenes/detalles.png"
                                               Stretch="Fill" />
                                    </telerik:RadMenuItem.Icon>
                                </telerik:RadMenuItem>
                                <telerik:RadMenuItem Header="Solicitar Evaluación" Name="MenuSolicitarEvaluacion">
                                    <telerik:RadMenuItem.Icon>
                                        <Image Height="16"
                                               Width="16"
                                               Source="/c3;component/Assets/Imagenes/ToolBar/Images/NewControl.png"
                                               Stretch="Fill" />
                                    </telerik:RadMenuItem.Icon>
                                </telerik:RadMenuItem>
                            </telerik:RadMenuItem>
                        </telerik:RadMenu>




                        <Button Click="btnNuevo_Click"
                                Tag="Agregar">
                            <Image Height="16"
                                   Source="/c3;component/Assets/Imagenes/ToolBar/Images/NewDocument.png"
                                   ToolTipService.ToolTip="Agregar"
                                   Width="16" />
                        </Button>
                        <telerik:RadToolBarSeparator />
                        <Button Click="btnEditar_Click"
                                Tag="Editar">
                            <Image Height="16"
                                   Source="/c3;component/Assets/Imagenes/editar.png"
                                   ToolTipService.ToolTip="Editar"
                                   Width="16" />
                        </Button>
                        <Button Click="btnEliminar_Click"
                                Tag="Eliminar">
                            <Image Height="16"
                                   Source="/c3;component/Assets/Imagenes/ToolBar/Images/DelControl.png"
                                   ToolTipService.ToolTip="Eliminar"
                                   Width="16" />
                        </Button>
                        <Button Click="btnVerDetalles_Click"
                                Tag="Consultar">
                            <Image Height="16"
                                   Source="/c3;component/Assets/Imagenes/detalles.png"
                                   ToolTipService.ToolTip="Consultar"
                                   Width="16" />
                        </Button>
                        <Button Click="btnSolicitarEvaluacion_Click"
                                Name="btnSolicitarEvaluacion"
                                Tag="Solicitar Evaluación">
                            <Image Height="16"
                                   Source="/c3;component/Assets/Imagenes/ToolBar/Images/NewControl.png"
                                   ToolTipService.ToolTip="Solicitar nueva evaluación"
                                   Width="16"/>
                        </Button>
                    </telerik:RadToolBar>
                    
                    <telerik:RadGridView ItemsSource="{Binding ElementName=evaluadoDomainDataSource, Path=DataView}"
                                         Name="radGridView1"
                                         Grid.Row="1"/>
                    
                    <telerik:RadDataPager Grid.Row="2"
                                          Name="pagerEvaluados"
                                          VerticalAlignment="Top"
                                          PageSize="14"
                                          DisplayMode="All"
                                          Source="{Binding DataView,ElementName=evaluadoDomainDataSource}" />
                </Grid>
            </c3Controles:BusyIndicator>
        </Grid>
    </UserControl>
  16. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 08 Apr 2011 Link to this post

    Hello Sami,

    Several other customers reported exactly the same issue. Their case turned out to be caused by the fact that the server refuses to return the TotalEntityCount to the client and the pager cannot do its math to calculate the total number of pages. I have still been unable to figure out why the server will not return this entity count. It appear to be some kind of optimization that might have been introduced between the Beta version of the WCF RIA Services SP1 and the retail version that came with the VS2010 update.

    Can you attach to the LoadedData event of RadDomainDataSource and check whether the event arguments will contain the true TotalEntityCount? In case they don't, you have to go the domain service on the server and tell it to return it. One way to do this is described in this forum thread. The guy has the same problem as you. Basically, you can add an out int parameter to the query method on the server and tell what the total entity count is in this out parameter.

    The more proper way to do that is to override the DomainService.Count method on the server and tell the total amount of entities.

    The bottom-line is that this magic number called TotalEntityCount has to be returned to the client so that RadDataPager can divide it by the PageSize and calculate the number of pages.

    By the way -- are you hitting different SQL Servers during development and production?

    In case the TotalEntityCount returned from the server is the proper one and your problem has nothing to do with anything I have written above, I will need a sample project that I can debug in order to determine what is wrong.

    I hope this helps.

    All the best,
    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
  17. Joshua
    Joshua avatar
    12 posts
    Member since:
    Dec 2010

    Posted 10 May 2011 Link to this post

    I must say this issue was driving me nuts, but thanks to this thread I have the answer. I thought I was doing something wrong. I decided in the end to override the count method on the domainservice. Thanks ;-).
  18. Naresh
    Naresh avatar
    31 posts
    Member since:
    Mar 2009

    Posted 08 Jul 2011 Link to this post

    Thanks to a post on another forum, I finally found the answer to the TotalEntityCount problem. One of our projects had a reference to the V1 version of System.ServiceModel.DomainServices.Client.dll instead of the V1 SP1 version. After correcting the reference TotalEntityCount contains the correct entity count even when a filter is applied. This problem as bugged me for months. Can't believe the solution was this simple!
Back to Top
DevCraft banner