I'm just looking to add a few options to the drop down list of, make it 15,50,150,250. There's got to be an easy way to do this yes? I don't want to change anything else on paging, but I have a feeling I need to change the pager template? Is there a template I can use that is exactly the same but I can update the drop down? Wish there was a need date source for that drop down. Any ideas would be great, thanks.
Joshua
9 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 23 Feb 2010, 05:34 AM
Hello Joshua,
The following code shows how to customize the PageSize combobox to show required options. Hope this helps.
C#:
Best wishes,
Shinu.
The following code shows how to customize the PageSize combobox to show required options. Hope this helps.
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("15")); |
PageSizeCombo.FindItemByText("15").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("150")); |
PageSizeCombo.FindItemByText("150").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; |
} |
} |
Best wishes,
Shinu.
0

lina fetisova
Top achievements
Rank 1
answered on 26 Jan 2011, 06:15 AM
Shinu, thank you very much!
0

Swaroop
Top achievements
Rank 1
answered on 04 Mar 2011, 10:34 AM
Can i able to Put option "All" in Pager dropdown so that to display all the items at a time?
0

Shinu
Top achievements
Rank 2
answered on 04 Mar 2011, 10:52 AM
Hello Swaroop,
Try the following code snippet to achieve your requirement.
C#:
Thanks,
Shinu.
Try the following code snippet to achieve your requirement.
C#:
protected
void
RadGrid1_ItemCreated(
object
sender,
GridItemEventArgs e)
{
if
(e.Item
is
GridPagerItem)
{
GridPagerItem pager = (GridPagerItem)e.Item;
RadComboBox PageSizeComboBox = (RadComboBox)pager.FindControl(
"PageSizeComboBox"
);
RadComboBoxItem ComboItem =
new
RadComboBoxItem(
"All"
);
PageSizeComboBox.Items.Insert(0, ComboItem);
PageSizeComboBox.AutoPostBack =
true
;
PageSizeComboBox.SelectedIndexChanged +=
new
RadComboBoxSelectedIndexChangedEventHandler(PageSizeComboBox_SelectedIndexChanged);
}
}
void
PageSizeComboBox_SelectedIndexChanged(
object
sender,
RadComboBoxSelectedIndexChangedEventArgs e)
{
//Handle the event
}
Thanks,
Shinu.
0

Swaroop
Top achievements
Rank 1
answered on 04 Mar 2011, 10:56 AM
thank you shinu...
0

Suresh
Top achievements
Rank 1
answered on 16 Jul 2012, 12:59 PM
How could this be done application wide?
Thanks,
Suresh.C
Thanks,
Suresh.C
0

Martin
Top achievements
Rank 2
answered on 20 Aug 2012, 12:23 PM
This is great and honestly super simple.
Thank you.
Thank you.
0

Amol
Top achievements
Rank 1
answered on 17 Sep 2012, 07:34 AM
Hi there,
you can use following code...
.Pageable(paging => paging.PageSize(5, new[] { 5, 10, 25, 50, 100, 200 }).Style(GridPagerStyles.NextPreviousAndNumeric | GridPagerStyles.PageSizeDropDown).Position(GridPagerPosition.Bottom))
you just need to add "new[] { 15,50,150,250 }" line to pageSize method
thank you,
Amol
you can use following code...
.Pageable(paging => paging.PageSize(5, new[] { 5, 10, 25, 50, 100, 200 }).Style(GridPagerStyles.NextPreviousAndNumeric | GridPagerStyles.PageSizeDropDown).Position(GridPagerPosition.Bottom))
you just need to add "new[] { 15,50,150,250 }" line to pageSize method
thank you,
Amol
0

Tassilo
Top achievements
Rank 1
answered on 20 Jul 2017, 09:09 AM
<PagerStyle PageSizes="500,1000,5000,10000" />