This is a migrated thread and some comments may be shown as answers.

Change advanced paging page-size dropdown options

5 Answers 346 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aaron Abdis
Top achievements
Rank 1
Aaron Abdis asked on 26 Oct 2009, 03:44 PM
Hi all, I have a grid which uses the advanced paging mode (next/prev, numeric buttons and page-size dropdown).
By default the page-size dropdown has options 10/20/50. We have a client request to change these options to 25/50/250.
How do I change these options?

I ideally don't want to have to write my own whole paging template, because then I would need to recreate also all the other functionality of the advanced pager... I just need to change the options in that dropdown.

Thanks in advance, CheerZ!

As an aside, is there a way i can make it so the user can type in 3-digits to the dropdown, instead of only 2? This should be enough to satisfy them then.

5 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 27 Oct 2009, 07:14 AM
Hi Aaron,

Try the following code snippet in order to access the PageSize combo and customize it according to your need by adding items to combo's item collection.

C#:
 
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    if (e.Item is GridPagerItem) 
    { 
        RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox"); 
 
        PageSizeCombo.Items.Clear(); 
        PageSizeCombo.Items.Add(new RadComboBoxItem("25")); 
        PageSizeCombo.FindItemByText("25").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID); 
        PageSizeCombo.Items.Add(new RadComboBoxItem("50")); 
        PageSizeCombo.FindItemByText("50").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID); 
        PageSizeCombo.Items.Add(new RadComboBoxItem("250")); 
        PageSizeCombo.FindItemByText("250").Attributes.Add("ownerTableViewId", RadGrid1.MasterTableView.ClientID);  
        PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = true
    }
}

Cheers,


Shinu.
0
Aaron Abdis
Top achievements
Rank 1
answered on 28 Oct 2009, 04:44 PM
Cool, thanks! That worked beautifully!! Though I wound up switching to advanced mode for the pager, but with the help of your code I made changes there too, to make the goToPage and changePageSize textboxes larger... 10px is a little small!  ;) 

Thanks for the help!
0
Sreedhar
Top achievements
Rank 1
answered on 28 Apr 2011, 07:26 AM
Hello Shinu,

I have used the code given by you for adding page size 100 and 200 to the dropdown. But now the performance is slow. Any idea or better approach for acheiving the functionality.

I am using Telerik RadGrid 2011

Thanks
Sreedhar
0
Shinu
Top achievements
Rank 2
answered on 28 Apr 2011, 07:39 AM
Hello Sreedhar,

When you present large number of records at once there will be delays in the grid operations execution. Actually, the problem lies in the browser which cannot handle large amounts of HTML. In your case the browser has to show 100/ 200 records at a time. Its is not a best approach to show large amount of data at a time. I recommend you to reduce the page size.

 Here is a documentation for more on grid performance optimizations.
Client/server grid performance optimizations.

Thanks,
Shinu.
0
Sreedhar
Top achievements
Rank 1
answered on 28 Apr 2011, 08:29 AM
Hello Shinu,

Thanks for the reply. Yup what you have pointed is correct.
I am using IE9 so think this should be the fastest.
As the page size is client request I cannot modify it :(

Thanks
Sreedhar
Tags
Grid
Asked by
Aaron Abdis
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Aaron Abdis
Top achievements
Rank 1
Sreedhar
Top achievements
Rank 1
Share this question
or