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

RadDataPager with RadGridView not working in LightSwitch

2 Answers 120 Views
DataPager
This is a migrated thread and some comments may be shown as answers.
alessandro
Top achievements
Rank 1
alessandro asked on 20 Sep 2011, 01:12 PM
Hi,
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"
    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"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400"
 xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="40"/>
            <RowDefinition />
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>
       
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="Search:" Margin="5"/>
            <TextBox Name="SearchBox" Margin="5" Width="200"/>
            <Button Content="Go!" Name="SearchButton" Margin="5" Width="50"/>
        </StackPanel>
        <telerik:RadGridView Name="ProductsGrid" AutoGenerateColumns="False"
                             ShowColumnFooters="False" ShowGroupPanel="False" ItemsSource="{Binding Screen.Products}" SelectedItem="{Binding Screen.Products.SelectedItem, Mode=TwoWay}">
            <telerik:RadGridView.Columns>
                <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:RadGridView.Columns>
        </telerik:RadGridView>
        <telerik:RadDataPager Name="RadPager1" PageSize="45" Grid.Row="2" IsTotalItemCountFixed="True" Source="{Binding ElementName=ProductsGrid, Path=Items}"/>
    </Grid>
   
</UserControl>


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 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 21 Sep 2011, 01:39 PM
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,
Ross
the Telerik team

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

0
Kelly
Top achievements
Rank 1
answered on 04 Oct 2011, 05:20 PM
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]
  LineNumber=189
  LinePosition=24
  StackTrace:
       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       at LightSwitchApplication.ActPendGrid.InitializeComponent()
       at LightSwitchApplication.ActPendGrid..ctor()
  InnerException:


Regards,

Kelly

Tags
DataPager
Asked by
alessandro
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Kelly
Top achievements
Rank 1
Share this question
or