this is my first post here, but I'm having a problem with the PageSizes setting for a grid.
Here is my markup for the Pager:
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
PageSizeLabelText
=
"Page Size: "
PageSizes
=
"{1, 10, 20, 50, 100, 200, 250}"
/>
And attached is an image showing what this produces (the grid has been removed because of client info).
As you can see, the first and last options are not present in the dropdown. Why is this?
My second question would be this: If I wanted (site-wide) to have 10,20, 50, 100, 200 as my page sizes, and 50 as the default...is there a way to do that without modifying all grids in my system individually?
17 Answers, 1 is accepted

Please create one skin file and add below code line in it.
<
telerik:RadGrid
runat
=
"server"
PageSize
=
"50"
AllowPaging
=
"true"
> </
telerik:RadGrid
>
Please check below link to customize page size comboBox.
http://jayeshgoyani.blogspot.in/2012/06/customizing-items-of-radgrid-page-size.html
Thanks,
Jayesh Goyani

A couple of followups:
1. So the PageSizes property inside the asp does not function correctly? I need to do it programatically like the blog post outlines?
2. I've done some looking at the skinning documentation (we are just using the default) and I don't see how creating a skin for RadGrid would change the default behavior of the combo box site wide. Maybe I am just misunderstanding what you mean.
Thanks!
Justin

I suppose you want to programmatically set the page size,please have a look at this code.
C#:
protected
void
RadGrid1_ItemDataBound(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
if
(e.Item
is
GridPagerItem)
{
RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl(
"PageSizeComboBox"
);
PageSizeCombo.Items.Clear();
PageSizeCombo.Items.Add(
new
RadComboBoxItem(
"10"
));
PageSizeCombo.FindItemByText(
"10"
).Attributes.Add(
"ownerTableViewId"
, RadGrid1.MasterTableView.ClientID);
PageSizeCombo.Items.Add(
new
RadComboBoxItem(
"20"
));
PageSizeCombo.FindItemByText(
"20"
).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(
"100"
));
PageSizeCombo.FindItemByText(
"100"
).Attributes.Add(
"ownerTableViewId"
, RadGrid1.MasterTableView.ClientID);
PageSizeCombo.Items.Add(
new
RadComboBoxItem(
"200"
));
PageSizeCombo.FindItemByText(
"200"
).Attributes.Add(
"ownerTableViewId"
, RadGrid1.MasterTableView.ClientID);
PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected =
true
;
}
}
ASPX:
<telerik:RadGrid ID=
"RadGrid1"
AllowPaging=
"True"
PageSize=
"50"
runat=
"server"
OnItemDataBound=
"RadGrid1_ItemDataBound"
>
<PagerStyle PageSizeControlType=
"RadComboBox"
></PagerStyle>
</telerik:RadGrid>
Thanks
Princy

Thanks for the answer, but the first response already explained (in the blog post) how to do it programatically. So I don't need that. What I would really like to know is why the PageSizes attribute doesn't work the way it should.
If you look at the original post I made, you will see that it sort-of works, but it leaves off the first and last options. Is this intended? I can't find any real documentation on this attribute.
Thanks,
Justin

The format of writing the PageSize is shown below,try removing the curly braces{..},please try this.
ASPX:
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
PageSizes
=
"1,10,20,30,40,50"
/>
Thanks,
Princy

Thank you! I'm going to give that a try and see what happens. Now my other question had to do with how to set this up as the default pagesize dropdown for every radgrid in my system. Someone above mentioned using a skin for this. How would I use a skin to accomplish that?
Thanks!
Justin

As far as i know we cant set any skin for pager,but we can set the CSS for that pager combobox.Every skin contains,its own style,so with that, inorder to set color for the pager combobox,we should give CSS.
ASPX:
<
telerik:RadGrid
ID
=
"RadGrid1"
AllowPaging
=
"True"
PageSize
=
"10"
Skin
=
"Web20"
>
<
PagerStyle
PageSizeControlType
=
"RadComboBox"
> <
/
PagerStyle
>
</
telerik:RadGrid
>
CSS:
div.RadGrid .RadComboBox td
{
background-color
: green;
background-image
:
none
;
border
:
0
none
;
}
Thanks,
Princy

The PageSizes Attribute is not working for me as well:
<telerik:RadGrid AutoGenerateColumns="false" ID="rgSearch"
AllowFilteringByColumn="True" AllowPaging ="true" AllowSorting="true"
runat="server" PageSize="50" onneeddatasource="rgSearch_NeedDataSource" Skin="WebBlue" >
<PagerStyle Mode="NextPrevAndNumeric" PageSizeLabelText="Page Size: " PageSizes="5,10,25,50,100,250" />
<
MasterTableView TableLayout="Auto" AllowMultiColumnSorting="true">
<CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false"></CommandItemSettings>
<Columns>
...
</Columns>
</MasterTableView>
<ExportSettings ExportOnlyData="false" OpenInNewWindow="true" HideStructureColumns="true">
<Excel Format="Biff" />
</ExportSettings>
</telerik:RadGrid>

You have placed the PagerStyle property out of MasterTableView,thats why,it takes the default value.Please set it after the MasterTableView.
ASPX:
<
telerik:RadGrid
AutoGenerateColumns
=
"false"
ID
=
"rgSearch"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"true"
AllowSorting
=
"true"
runat
=
"server"
PageSize
=
"50"
Skin
=
"WebBlue"
>
<
MasterTableView
TableLayout
=
"Auto"
AllowMultiColumnSorting
=
"true"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
PageSizeLabelText
=
"Page Size: "
PageSizes
=
"5,10,25,50,100,250"
/>
<
CommandItemSettings
ShowExportToExcelButton
=
"true"
ShowAddNewRecordButton
=
"false"
/>
<
Columns
>
. . . . . . . . .
. . . . . . . . .
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
Thanks,
Princy


The PageSizes Attribute is not working for me
<telerik:RadGrid ID="grdJobList" runat="server" GridLines="None" Skin="Outlook" AllowPaging="true"
AllowSorting="True"
OnNeedDataSource="RadGridStockRecevedStatus_NeedDataSource" PageSize="50"
AllowFilteringByColumn="True" OnDeleteCommand="grdJobList_DeleteCommand"
OnItemCommand="grdJobItem_ItemCommand">
<GroupingSettings CaseSensitive="false" />
<MasterTableView AutoGenerateColumns="False" DataKeyNames="Id,JobType,DepartmentCode"
CommandItemDisplay="Top">
<PagerStyle Mode="NextPrevAndNumeric" PageSizeLabelText="Page Size: " PageSizes="5,10,25,50,100,250" />
<CommandItemTemplate>
<asp:Button ID="BtnCSV" runat="server" CssClass="btnGridAddItm" CommandName="ExportToCsv"
Text="Export to CSV"></asp:Button>
</CommandItemTemplate>
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
</Columns>

Hello Kasun,
It would be nice if you can provide telerik DLL version.
Thanks,
Jayesh Goyani

http://stackoverflow.com/questions/33822075/cannot-identify-selected-page-in-telerik-grid-i-need-selected-page-to-be-underl
Plz go through the link and and help me

Hi Kiran,
When the PagerStyles is placed outside the MasterTable it takes the default value of the Grid. There are many properties in the Grid that can be set both on Grid and on MasterTable level depending on the scope of the applied value.
You can find more detailed information on this matter here:
Regards,
Vessy
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Hi Vessy,
Now I understand. Thank you for the information.
Hi,
You are welcome, Kiran, I am glad my reply shed some light on this matter.
Regards,
Vessy
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.