Hi,
Just started using your RadGrid for ASP.net here at work and have a table with about 500,000 rows that I am testing with. Sorting/Paging/Filtering all works fine and I am able to build a custom linq query to only return the rows i need to be displayed...but, I'm not having any luck doing that with grouping as I need to return the entire resultset for radgrid to group correctly.
As the rows increase in the database table, so does the time it takes for the page to load when grouped or when performing any type of grouping, i'm using the following code for testing, and currenly have PageSize set to 10, as per the default.
Is there any way to improve the performance?
Take Care
Just started using your RadGrid for ASP.net here at work and have a table with about 500,000 rows that I am testing with. Sorting/Paging/Filtering all works fine and I am able to build a custom linq query to only return the rows i need to be displayed...but, I'm not having any luck doing that with grouping as I need to return the entire resultset for radgrid to group correctly.
As the rows increase in the database table, so does the time it takes for the page to load when grouped or when performing any type of grouping, i'm using the following code for testing, and currenly have PageSize set to 10, as per the default.
Protected
Sub
RadGrid1_NeedDataSource(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridNeedDataSourceEventArgs)
Handles
RadGrid1.NeedDataSource
Dim
db
As
New
TrackerDataContext
db.Log =
New
System.Diagnostics.DebuggerWriter
Dim
query = From p
In
db.posts
Where p.parentid = 0
Select
p
If
String
.IsNullOrWhiteSpace(RadGrid1.MasterTableView.FilterExpression) =
False
Then
query = query.Where(RadGrid1.MasterTableView.FilterExpression)
End
If
For
Each
exp
As
GridSortExpression
In
RadGrid1.MasterTableView.SortExpressions
query = query.OrderBy(
String
.Format(
"{0} {1}"
, exp.FieldName, exp.SortOrder.ToString))
Next
Dim
start
As
Integer
= RadGrid1.CurrentPageIndex * RadGrid1.PageSize
Dim
max
As
Integer
= RadGrid1.PageSize
RadGrid1.AllowCustomPaging =
True
'we always need count
RadGrid1.VirtualItemCount = query.Count
If
isGrouping
Or
RadGrid1.MasterTableView.GroupByExpressions.Count > 0
Then
start = 0
max = RadGrid1.VirtualItemCount
RadGrid1.AllowCustomPaging =
False
End
If
RadGrid1.DataSource = query.Skip(start).Take(max)
End
Sub
Private
isGrouping
As
Boolean
=
False
Protected
Sub
RadGrid1_GroupsChanging(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridGroupsChangingEventArgs)
Handles
RadGrid1.GroupsChanging
isGrouping =
True
If
e.Action = GridGroupsChangingAction.Ungroup
AndAlso
RadGrid1.MasterTableView.GroupByExpressions.Count = 1
Then
isGrouping =
False
End
If
End
Sub
Is there any way to improve the performance?
Take Care