RadGridView and RadDataPager sample application (http://www.telerik.com/products/silverlight/resources/lightswitch-support.aspx) may only work with a few thousands records. Any more than that, it is too slow and not practical, as it eventually crashes with large records.
The problem is that Rad control will try to load all the records at initial page loading. To test this, just add a button as below to generate more records with the above sample application.
Unfortunately I discovered this fact after I spent lots of hours after the product purchase.
I wonder whether Telerik is aware of this major issue.
partial void BulkAddMethod_Execute()
{
for (int i = 1; i < 10000; i++)
{
Customer cus = this.Customers.AddNew();
cus.Name = "test " + i;
if (i % 1000 == 0)
this.Save();
}
this.Save();
}
33 Answers, 1 is accepted
Do you have different behavior with standard Silverlight DataGrid/DataPager in this case? Is this issue only with RadGridView?
Let us know!
Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
With the standard LightSwitch data grid and pager, there is no issue at all. It happens when I replace LightSwitch datagrid with RadGridView.
If you test the sample Telerik application against 10,000 records, you will see the problem.
I found that the following link describes the issue in detail.
"if you looked at the sql profiler you'd see that it calls "Load" and selects the entire table, which makes it pretty useless (the paging is only at the GUI level... and what I'm interested in is the DB level)...."
http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/7a87f55e-49c6-451e-8763-9f2526118982/#78d2de28-c514-4dca-8e12-f842ea3dbcab
With a 40,000 records table, RadGridView attempts to download the whole table contents at loading time and then, after a while, it freezes with "...not responding.." message.
I tried binding at code behind but it makes no difference.
LightSwitch datagrid lacks the features of Telerik GridView.
I really need the features of RadGridView and need to find a way to make it work with LightSwitch somehow.
Thanks.
Young
As far as I understand you have RadDataPager - right? Can you post more info? If the pager is properly bound you will get only page size data.
Kind regards,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Exactly, you are right.
I use RadDataPager with RadGridView. And RadDataPager should fetch only one page size of data, but in fact it will try to get the entire collection first. In doing so for a large table it fails making RadGridView unusable.
Here is the xaml, as is extracted from Telerik sample applicaiton for LightSwitch and RadGridView demonstration.
(http://www.telerik.com/products/silverlight/resources/lightswitch-support.aspx)
If you can, please run this sample application, but with many more records.
Anyway thanks for your help. I really wish that this issue could be resolved.
Young
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
telerik:RadGridView
x:Name
=
"xRadGridView"
ItemsSource
=
"{Binding Screen.Customers, Mode=OneWay}"
AutoGenerateColumns
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"Name"
IsReadOnly
=
"True"
DataMemberBinding
=
"{Binding Name}"
/>
<
telerik:GridViewDataColumn
Header
=
"Location"
DataMemberBinding
=
"{Binding Location}"
/>
<
telerik:GridViewDataColumn
Header
=
"Is Available"
IsReadOnly
=
"True"
DataMemberBinding
=
"{Binding IsAvailable}"
/>
<
telerik:GridViewDataColumn
Header
=
"Date Added"
DataMemberBinding
=
"{Binding DateAdded}"
/>
<
telerik:GridViewDataColumn
Header
=
"Revenue ($)"
DataMemberBinding
=
"{Binding Revenue}"
DataFormatString
=
"{}{0:c}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
<
telerik:RadDataPager
PageSize
=
"30"
Source
=
"{Binding Items, ElementName=xRadGridView}"
Grid.Row
=
"1"
IsTotalItemCountFixed
=
"False"
/>
</
Grid
>
Can you try this binding instead?
<telerik:RadGridView ItemsSource="{Binding PagedSource, ElementName=RadDataPager1}" AutoGenerateColumns="False">
<telerik:RadDataPager x:Name="RadDataPager1" PageSize="30" Source="{Screen.Customers}" Grid.Row="1" IsTotalItemCountFixed="False"/>
Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I tested your code exactly as described.
Unfortunately the result is exactly the same as before. It fetches all the records, first before the initial single page records display.
I then removed RadGridView just leaving RadDataPager. Still the same result except that GridView is not displayed.
Binding to "Screen.Customers" is the correct way of doing it, as with any other Silverlight controls. But it looks like that RadDataPager is not compatible with LightSwitch.
I tested these by creating 40,000 records filling just one column for Customer Name. It takes about 25 seconds to load.
With more complicated table with that many records, it will just freeze.
I also tried "unbound" mode controlling the paging manually.
view.ItemsSource = this.Customers.Take(pager.PageSize);
In this case this works just fetching the first page. Then I could use PageIndexChanged event to navigate pages. But I lose the benefits of grouping, sorting, filtering...etc, as it works only for the current page then. I need filtering for the entire collection.
I am wondering whether QueryableDomainServiceCollectionView<TEntity> class should be used inbetween somehow. I am not familiar with this class though. Can we wrap Screen.Customers with this class?
Any further suggestion would be appreciated.
Young
Both RadGridView and RadDataPager are just consumers of data. The actual data retrieval and paging is provided by LightSwitch . Typically by default any search screens or editable grid screens in LightSwitch are configured to return 45 items of data per page.
It seems for some reason in your case a bigger amount of data is requested and fetched from the server.
I may offer my further help on this matter in two alternative ways (please chose one) :
1. In case I can have a runnable repro version of your project I will gladly debug it in order to find out what is causing the data to be fetched exceeding the page size.
or
2. You may give me runnable a version of your project with the relevant data ( could be set with the default MS Grid and even the Northwind database) . I may offer my help here with replacing the default MS Grid with RadGridView while ensuring data is being fetched at portions ( pages ) as per your request. Later I will get the modified and fixed version back to you .
Please let me know which way would be most convenient for you .
All the best,
Pavel Pavlov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Thanks for your willingness to help with kind offers.
I considered sending the test project but at the moment it is 20mb compressed in 7z.
But this project is just based on Telerik sample and nothing different.
http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/7a87f55e-49c6-451e-8763-9f2526118982/#78d2de28-c514-4dca-8e12-f842ea3dbcab
So I suggest that you could enhanse your own sample project to show how RadDataPage could work with LightSwitch.
Where Telerik sample uses a RadGridView, I tried to add RadDataPager like any other Silverlight project. But I could not make it work.
Let me explain.
In case you are not familiar with LightSwitch, you can open the xaml file this way.
Opening the above project, switch to "File View" from "Logical View" from Solution Explorer tool bar.
From "Client" folder, open RadGridControl.xaml and add a RadDataPager as if it is a Silverlight xaml page. It will look like as I posted earlier. Then F5 to see that there is one page and work ok.
Now to test with more data, you need to add additional test data.
1. Switch back to "Logical View".
2. From Screens, add a new screen as CustomersListDetails selecting ListDetail and Customers.
3. Add a button(eg. "BulkAddMethod") from Screen Command Bar and right click to open "Edit execute code". Then add the code as I posted earlier. When you run the app and execute the button it will add test data.
4. You will see just 1 page full of data. But I expect that I could be able to skip to next page but RadDataPager does not know the rest of the records.
5. To show all data here, open "EditableRadGrid" screen. When you select "Customers" on top left corner, you will see properties. Here you can switch off "Support Paging" and run the app. You will see all data with paging. But the problem is that all the records will be downloaded first and loading takes lots of time depending on the size of the table.
If you need more information, please let me know.
Thanks anyway.
Young
I have tried paging with the following setup :
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
telerik:RadGridView
ItemsSource
=
"{Binding PagedSource, ElementName=RadDataPager1}"
SelectedItem
=
"{Binding Value.SelectedItem, Mode=TwoWay}"
telerik:StyleManager.Theme
=
"Office_Blue"
RowDetailsVisibilityMode
=
"VisibleWhenSelected"
>
</
telerik:RadGridView
>
<
telerik:RadDataPager
x:Name
=
"RadDataPager1"
Source
=
"{Binding Value}"
PageSize
=
"10"
Grid.Row
=
"1"
telerik:StyleManager.Theme
=
"Office_Blue"
/>
</
Grid
>
It seems to work OK .
This was tested with the approach from Vlad's blogpost on LightSwitch, RadGridView and datapaging.
Kind regards,
Pavel Pavlov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Thanks for your continous attention and support. Appreciated.
As suggested, I copied your code and tested it again. Also reread Vlad's article.
Unfortunately it did not work for me. Rad control downloaded every records taking 20 seconds (40,000 records), before the screen becomes ready. It downloaded 27Mb of data.
Here is the comparison between the native LightSwitch Datagrid and Rad GridView. I measured it using IE developer tools (F12).
1. LightSwitch Datagrid:
/ApplicationData.svc/Customers()?$skip=0&$top=45&$inlinecount=allpages ==> 31.10 KB
2. Rad GridView/DataPager:
/ApplicationData.svc/Customers ==> 26.77 MB
So, in this example, the problem is that there is no known method of sending $skip and $top information to LightSwitch data source using RadDataPager.
Can you run your test app again as a browser app? Then trace it with IE developer tools or Fiddler to confirm that Rad control actaully sends $skip and $top parameters to the data source.
Edit: I can actually activate paging for RadDataPager. Then the problem is that RadDataPager will report that there are only 45 records. Does your test app show that there are more than 45 records?
I really have to make this work soon to stay with Telerik. I am sure that this could be fixed somehow.
Regards,
Young
As you have mentioned that everything works with the MS controls, I will kindly ask you to share such project. In case you can provide a working project with the MS DataGrid , we can try modify it to use Telerik controls in the same manner. I believe we do not have much chance to solve the issue without working on a project of yours which exactly resembles your specific scenario.
Regards,
Pavel Pavlov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Here is the link to download the sample project file.
https://skydrive.live.com/#cid=C81A180DF8ABD2BC&id=C81A180DF8ABD2BC%21128
The project was developed using Visual Studio 11 beta and you will need to use Visual Studio 2012 RC unless you have VS11 beta.
(I am certain that the issue will be the same even with LightSwitch 2010).
In case you have to reattach references to Telerik controls, you can do so from Solution Explorer buttons->File View->Client folder->References.
Once everything is ready and the app is running, you need to add test data. Go to "LightSwitch DataGrid" screen and click the "Add Data" button on top. It will add 40,000 records. Now you can compare the differences.
Hope you could find the solution.
Thanks.
Young
I've added Telerik binaries (version 2012.1.0326) to the project references, built and started the application. The result I get is as follow:
1. The first tab - Editable Rad Grid - contains RadGridView with no items.
2. The second tab - LightSwitch DataGrid - contains DataGrid with no items.
3. Clicking on Add Data button starts adding data to DataGrid. This button is not presented for the RadGridView.
4. I've added such button for RadGridView and the data was added and paged correctly.
Can you please specify how to reproduce the issue? Do I need to setup something additional or to follow given steps? Thank you for your cooperation.
All the best,
Yordanka
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Thanks for your kind help. You have set it up correctly.
1. The first tab - Editable Rad Grid - contains RadGridView with no items. => OK
2. The second tab - LightSwitch DataGrid - contains DataGrid with no items. => OK
3. Clicking on Add Data button starts adding data to DataGrid. This button is not presented for the RadGridView. => OK
4. I've added such button for RadGridView and the data was added and paged correctly. => It was not necessary to add the button but the records will be displayed anyway. You could have clicked "Refresh" button on the first tab screen without adding this button.
Can you tell me how many pages there are on Editable Rad Grid screen? 1 of ???? pages?
There are about 40,000 records and it should be 4000 pages, if there are 10 records per page.
On my screen EditableRadGrid shows that there are 5 pages. It did not count the total number of pages correctly.
LightSwitch DataGrid correctly counts all the records, while RadGridGriw does not.
If you have all the pages(4,000) shown correctly, your version must be running ok with no problem. Please confirm if this is the case with yours.
* GridView control I use says version is "2012.1.326.1050" and runtime version is "v4.0.30319" from Visual Studio properties panel.
I guess that it is the same version.
Regards,
Young
http://www.telerik.com/community/forums/silverlight/data-pager/raddatapager-with-radgridview-not-working-in-lightswitch.aspx
It seems to me that this problem still has not been identified and addressed by Telerik.
I am concluding that RadGridView is NOT ready for LightSwitch yet.
Young
I linked this forum page to LightSwitch community as below.
Hopefully Telerik could notice that there are lots of interests in your product from LightSwitch users.
http://social.msdn.microsoft.com/Forums/en-US/LightSwitchDev11Beta/thread/6300028b-24d1-43d5-889c-5924e8cda5c4/?prof=required
Why does it not support virtualisation like in WPF/Silverlight?
Can you show us how you've specified PageSize?
Greetings,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I did not specify a page size (I am not using the RadPager control, I am binding to 1000 invoices). The PageSize is set in Lightswitch by default to 45 on that screen. I was hoping the Telerik Grid would use Virtualisation to load the 1000 records so that only the visible ones were loaded (isn't that how it works?)
Instead it falls over on load.
Thanks
Actually no. The grid by default will not perform any data virtualization - if you want such you can use our virtual collection or pager.
I suggest you to check our demos and documentation for more info.
Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
http://www.telerik.com/help/wpf/radgridview-features-ui-virtualization.html
I thought it would only load the viewable records and you could bind to 1000's of records.
This is related to UI virtualization - not data virtualization.
Kind regards,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Here is my proof:
I have a simple lightswitch app which shows Projects. I have 432 projects (which will grow over time). I have the Telerik RadGridView with a Telerik DataPager and I have another screen with the normal inbuilt Lightswitch (LS) grid. From the UI everything looks great, although on the Telerik screen the computed/calculate fields take a long time to update in the UI and the screen takes a while to load, even though it is only DISPLAYING 45 records. The LS screen loads a lot quicker and is a lot more responsive.
I then run SQL Profile on my database - The Telerik Screen is loading all 432 records up front and then loading 1 select statement per row for ALL 432 records, even though only 45 are visible.
The LS screen is only selecting 45 records...
Here is my XAML:
<
Controls:RadGridView
x:Name
=
"xRadGridView"
ItemsSource
=
"{Binding PagedSource, ElementName=RadDataPager1}"
SelectedItem
=
"{Binding Value.SelectedItem, Mode=TwoWay}"
EnableColumnVirtualization
=
"True"
EnableRowVirtualization
=
"True"
telerik:StyleManager.Theme
=
"Windows7"
CanUserFreezeColumns
=
"True"
FrozenColumnCount
=
"1"
IsReadOnly
=
"True"
ColumnWidth
=
"90"
ShowColumnFooters
=
"True"
AutoGenerateColumns
=
"False"
>
<
telerikData:RadDataPager
x:Name
=
"RadDataPager1"
Source
=
"{Binding Value}"
PageSize
=
"20"
telerik:StyleManager.Theme
=
"Windows7"
Grid.Row
=
"1"
/>
The screen is set to retrieve 100000 records (if I don't do this then it only shows 45 records and Page 1 of 1, which is useless).
So this pretty much renders it unusable for me too - what have I missed? How do I do server side paging with the Telerik RadGridView in Lightswitch?
For server-side operations like paging, sorting, filtering, etc. you need custom solution since unfortunately the entire server-side Lightswitch functionality is not hidden behind standard interfaces like IPagedCollectionView, etc. similar to WPF and Silverlight. They have custom collections, especially for Lightswitch, with custom logic for paging, sorting, etc. You will need to translate the standard IPagedCollectionView properties (used in RadGridView, RadDataPager, etc.) like PageIndex, ItemCount, PageSize, etc. to the custom Lightswitch paging properties. You may need also to use custom parameterized Lightswitch queries.
All the best,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Would it be possible to provide an example project with this done? It is not really usable for any serious project if it does not support server-side paging so I am sure many customers would benefit from it.
I suggest you to check this article in Lightswitch documentation for getting started:
http://msdn.microsoft.com/en-us/library/ff852026.aspx
Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I've made small demo project demonstrating how to achieve server-side paging using RadDataPager unbound mode. You can check the project and the blog post here.
Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Thanks for the sample.
For paging, yes it worked. You made it finally.
I feel that we are getting to the working solution, but not quite the complete solution yet.
Remaining issues.
1. When moved to another page, somehow now it flickers the entire control area clearing it into blank white and then it displays the next page.
2. Filtering, sorting will only work within the page itself, not from the entire collection. Filtering was the reason to use Telerik control for me.
I hope you could find the answers somehow.
Young
Similar to paging you should pass the grid SortDescriptors and FIlterDescriptors to your LightSwitch queries. Have you tried that? Do you have any particular question?
All the best,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
http://screencast.com/t/9KrHPJwdWh
Note: I have only shown a very narrow video as it contains sensitive data, however you can see how the whole grid disappears when it rebinds.
electronic workscope
Could you please enhance your prototype to include Filtering, Grouping, Sorting etc. as Young pointed out, these are the only reasons why I went with Telerik and it has been quite frustrating getting it to work with Lightswitch, despite claims from Telerik that it is so simple etc. (which is true, but not for any real business app with realistic amounts of data (I have 1400 records in a 6 megs database and it is almost unusable without this server-side paging)
As I said in my previous reply if you want to use the LightSwitch generated data-source you need to code everything from simple things like paging to complex operations like filtering and grouping. You can check also official Microsoft LightSwitch forums to know more about how simple operation like getting total items count are almost impossible - especially for regular developers.
There is however a shortcut to whole server-side story since the LightSwitch itself is using WCF Data Services to consume data and we have pretty complete offering on this front with RadDataServiceDataSource. If you do not want to code a lot and you want everything executed on the server you can create a separate module for your LightSwitch application (similar to my project) with the same data connection. You will get almost everything working on the server-side completely codeless.
Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I've just published a blog post (with a sample application) to illustrate how to consume LightSwitch OData services in order to enable server-side sorting, filtering, paging, etc.
Greetings,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.