There is a bug in the RadGrid Pager when the page size is set to Integer.MaxValue (I added an "All" options to the page sizes). Instead of displaying "Page 1 of 1" it displays "Page 1 of 0". Some of the GridPagerItem.Paging values are also incorrect. Here is what they contain in the ItemCreated and ItemDataBound events:
Count = 21474483647
CurrentPageIndex = 0
DatasourceCount = 240
FirstIndexInPage = 0
IsFirstPage = True
IsLastPage = False
LastIndexInPage = 239
PageCount = 0
PageSize = 21474483647
This is the code I use to modify the page sizes dropdown list:
There is another strange thing to in that, if I add the "All" item as the last item to the PageSizeComboBox as above, upon postback the .Text of the item is no longer "All", but the same as the .Value.
There's other strange behavior with the PageSizeComboBox items on postback as well. If I add an item to the end that contains a fairly small value, it gets sorted first instead of last, and the default items that I did not add back (like "20" and "50") still show up in the items list.
Count = 21474483647
CurrentPageIndex = 0
DatasourceCount = 240
FirstIndexInPage = 0
IsFirstPage = True
IsLastPage = False
LastIndexInPage = 239
PageCount = 0
PageSize = 21474483647
This is the code I use to modify the page sizes dropdown list:
Public
Sub
SetPageSizes(oPagerItem
As
GridPagerItem, aSizes
As
String
())
Dim
rcbPager
As
RadComboBox =
DirectCast
(oPagerItem.FindControl(
"PageSizeComboBox"
), RadComboBox)
Dim
iTotalItems
As
Integer
= oPagerItem.Paging.DataSourceCount
rcbPager.Items.Clear()
For
Each
sSize
As
String
In
aSizes
Dim
iSize
As
Integer
= 0
If
sSize.ToUpper() =
"ALL"
Then
iSize =
Integer
.MaxValue
Else
If
Not
Integer
.TryParse(sSize, iSize)
Then
Continue
For
ElseIf
iTotalItems < iSize
Then
Continue
For
End
If
End
If
Dim
oNewItem
As
New
RadComboBoxItem(sSize, iSize.ToString())
oNewItem.Attributes.Add(
"ownerTableViewId"
, oPagerItem.OwnerTableView.ClientID)
rcbPager.Items.Add(oNewItem)
Next
If
iTotalItems > 0
Then
Dim
oItem
As
RadComboBoxItem = rcbPager.FindItemByValue(oPagerItem.OwnerTableView.PageSize.ToString())
If
oItem IsNot
Nothing
Then
oItem.Selected =
True
End
If
End
If
End
Sub
There is another strange thing to in that, if I add the "All" item as the last item to the PageSizeComboBox as above, upon postback the .Text of the item is no longer "All", but the same as the .Value.
There's other strange behavior with the PageSizeComboBox items on postback as well. If I add an item to the end that contains a fairly small value, it gets sorted first instead of last, and the default items that I did not add back (like "20" and "50") still show up in the items list.