I am binding with objects and paging my data, relying on PageSize and PageIndex properties of the RadGrid to determine what rows to pull. When I change the page size I step into RadGrid1_PageSizeChanged and verify that e.NewPageSize is correct. I then step into RadGrid1_NeedDataSource and the PageSize is still set to the old value. I was thinking of using Session or ViewState variables to store the values as a work around but shouldn't the PageSize be set to the new page size right after the PageSizeChanged event?
Here is my VB:
What am I doing wrong?
Thanks,
Dan
Here is my VB:
Protected
Sub
RadGrid1_PageSizeChanged(sender
As
Object
, e
As
Telerik.Web.UI.GridPageSizeChangedEventArgs)
Handles
RadGrid1.PageSizeChanged
RadGrid1.CurrentPageIndex = 0
Session(
"LeadsPageSize"
) = e.NewPageSize
RadGrid1.Rebind()
End
Sub
Protected
Sub
RadGrid1_NeedDataSource(sender
As
Object
, e
As
Telerik.Web.UI.GridNeedDataSourceEventArgs)
Handles
RadGrid1.NeedDataSource
Dim
Customer_id
As
String
=
DirectCast
(
Me
.Parent.FindControl(
"hfCustomer_id"
), HiddenField).Value
If
Customer_id =
""
OrElse
Not
IsNumeric(Customer_id)
Then
divLeads.Visible =
False
Else
Dim
StartRow
As
Int32
Dim
EndRow
As
Int32
StartRow = RadGrid1.CurrentPageIndex * RadGrid1.PageSize + 1
EndRow = StartRow + RadGrid1.PageSize - 1
If
EndRow > RadGrid1.VirtualItemCount
Then
EndRow = RadGrid1.VirtualItemCount
If
StartRow > EndRow
Then
StartRow = EndRow
Dim
objDT
As
DataTable = Customer.SelectLeadsRangeByCustomer(Customer_id, StartRow, EndRow)
If
objDT.Rows.Count = 0
Then
divLeads.Visible =
False
Else
RadGrid1.DataSource = objDT
End
If
End
If
End
Sub
What am I doing wrong?
Thanks,
Dan