RadDataPager with RadGridView not working in LightSwitch

3 posts, 0 answers
  1. alessandro
    alessandro avatar
    8 posts
    Member since:
    Aug 2008

    Posted 20 Sep 2011 Link to this post

    I'm building a user control including a RadGridView and a RadDataPager in order to replace the default DataGrid in Visual Studio LightSwitch. I've tried this with different collections, but the DataPager does not page data. Basically only the first page is shown.
    Say I've bound my control to the Products table from the Northwind database, exposed by a search screen.
    This is my code:

    <UserControl x:Class="HelperControls.GridControl"
        d:DesignHeight="300" d:DesignWidth="400"

        <Grid x:Name="LayoutRoot" Background="White">
                <RowDefinition Height="40"/>
                <RowDefinition />
                <RowDefinition Height="30"/>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Search:" Margin="5"/>
                <TextBox Name="SearchBox" Margin="5" Width="200"/>
                <Button Content="Go!" Name="SearchButton" Margin="5" Width="50"/>
            <telerik:RadGridView Name="ProductsGrid" AutoGenerateColumns="False"
                                 ShowColumnFooters="False" ShowGroupPanel="False" ItemsSource="{Binding Screen.Products}" SelectedItem="{Binding Screen.Products.SelectedItem, Mode=TwoWay}">
                    <telerik:GridViewDataColumn Header="Product Name" DataMemberBinding="{Binding ProductName}"/>
                    <telerik:GridViewDataColumn Header="Quantity per Unit" DataMemberBinding="{Binding QuantityPerUnit}"/>
                    <telerik:GridViewDataColumn Header="Unit Price" DataMemberBinding="{Binding UnitPrice, StringFormat=c}"/>
            <telerik:RadDataPager Name="RadPager1" PageSize="45" Grid.Row="2" IsTotalItemCountFixed="True" Source="{Binding ElementName=ProductsGrid, Path=Items}"/>

    The collection is corretcly bound and shown in the RadGridView, but it is not paged. The PageSize reflects the same property of the query in LightSwitch that exposes the collection; this also has paging enabled.

    Thanks for any suggestions.
    P.s. sorry for not formatting the code block but the result was not nice to see ;-)

  2. Rossen Hristov
    Rossen Hristov avatar
    2478 posts

    Posted 21 Sep 2011 Link to this post

    Hello Alessandro,

    In order to identify the cause of this problem we will need some additional information.

    1. Does this setup work correctly in a non-LightSwitch environment?
    2. In LigthSwitch, if you replace our controls with the stock DataGrid and DataPager is the behavior different?

    We are looking forward to hearing from you.

    Best wishes,
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Kelly
    Kelly avatar
    11 posts
    Member since:
    Oct 2011

    Posted 04 Oct 2011 Link to this post

    Hello Alessandro,

    I am having the same issue.

    When I follow the demo http://demos.telerik.com/silverlight/#GridView/PagingLargeData.  I am using Lightswitch as well.

    When I paste in the XAML editor

    <telerik:RadDataPager PageSize="100" Grid.Row="1" Source="{Binding Items, ElementName=GridView}" IsTotalItemCountFixed="True" DisplayMode="FirstLastPreviousNextNumeric, Text" />

    The pager displays; however, within a few seconds an error is displayed.  Even when I try to remove the pager, the application remains broken.

    Example of the error:

    System.Windows.Markup.XamlParseException occurred
      Message=The type 'RadDataPager' was not found. [Line: 189 Position: 24]
           at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
           at LightSwitchApplication.ActPendGrid.InitializeComponent()
           at LightSwitchApplication.ActPendGrid..ctor()



Back to Top