
Patrick Stovall
Top achievements
Rank 1
Patrick Stovall
asked on 15 Jan 2009, 04:19 PM
Is it possible to limit the max page size? Some of our data is quite large and alot goes on in rendering. We want to limit the max page size so we don't have a degredation of performance. Any assistance would be greatly appreciated.
4 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 16 Jan 2009, 03:45 AM
Hi Patrick,
If you have set AllowPaging to true you can limit the number of rows displayed in a Grid using the PageSize property. Set PageSize property to a desired value as shown below.
ASPX:
Thanks
Shinu
If you have set AllowPaging to true you can limit the number of rows displayed in a Grid using the PageSize property. Set PageSize property to a desired value as shown below.
ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="true" PageSize="5" > |
Thanks
Shinu
0

Patrick Stovall
Top achievements
Rank 1
answered on 16 Jan 2009, 02:14 PM
Shinu,
Thanks for the reply.
Unfortunately that works for the initial loading of the page but the user can still change the pagesize via the pager control bar at the bottom of the grid. So in our example, we have over 2700+ records available and on the initial page load, we display the first 100. The user could potentially enter in 1000 records per page or all of the records on one page. This slows things down quite a bit because of some other code that is executing record by record. So my thought was to limit the entry on the page change to a maximum number. I'm assuming there isnt' a way to control this?
Thanks.
Pat.
Thanks for the reply.
Unfortunately that works for the initial loading of the page but the user can still change the pagesize via the pager control bar at the bottom of the grid. So in our example, we have over 2700+ records available and on the initial page load, we display the first 100. The user could potentially enter in 1000 records per page or all of the records on one page. This slows things down quite a bit because of some other code that is executing record by record. So my thought was to limit the entry on the page change to a maximum number. I'm assuming there isnt' a way to control this?
Thanks.
Pat.
0
Hello Patrick,
I recommend you the following approach:
Hope this helps.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I recommend you the following approach:
protected void RadGrid1_PreRender(object sender, EventArgs e) |
{ |
GridPagerItem pagerItem = (GridPagerItem)RadGrid1.MasterTableView.GetItems(GridItemType.Pager)[1]; |
RadNumericTextBox textBox = (RadNumericTextBox)pagerItem.FindControl("ChangePageSizeTextBox"); |
textBox.MaxValue = 5; |
} |
Hope this helps.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

Cradz
Top achievements
Rank 1
answered on 12 Jan 2012, 10:10 PM
Just an FYI as I couldn't find any other topics on this so helping anybody who has this issue in the future. :)
I was having this same problem and for some reason the pre_render way isn't working for me.
I fixed it using the ItemCreated event instead like so:
I was having this same problem and for some reason the pre_render way isn't working for me.
I fixed it using the ItemCreated event instead like so:
Protected Sub dgrPosts_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles dgrPosts.ItemCreated
If TypeOf e.Item Is GridPagerItem Then
Dim gridPager As GridPagerItem = TryCast(e.Item, GridPagerItem)
Dim textBox As RadNumericTextBox = DirectCast(gridPager.FindControl("ChangePageSizeTextBox"), RadNumericTextBox)
textBox.MaxValue = 50
End If
End Sub