Question

I am using Telerik's RadDataPager to handle pagination for a ListView control.

One of the features of this control is the ability to allow users to select how many records they would like to see per page via a drop down list. By default, the drop down list options are 5, 10, 20, and 50; however, there is a property of the control where you can define a different set of values if you would like.

Using the example provided by Telerik, I have this code:

<telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="RadListViewMaster">
    <Fields>
        <telerik:RadDataPagerButtonField FieldType="FirstPrev" />
        <telerik:RadDataPagerButtonField FieldType="Numeric" PageButtonCount="5" />
        <telerik:RadDataPagerButtonField FieldType="NextLast" />
        <telerik:RadDataPagerPageSizeField PageSizeComboWidth="60" PageSizeText="Page size: " PageSizes="10; 25; 50" />
        <telerik:RadDataPagerGoToPageField CurrentPageText="Page: " TotalPageText="of" SubmitButtonText="Go" TextBoxWidth="30" />
        <telerik:RadDataPagerTemplatePageField>
            <PagerTemplate>
                <div style="float: right">
                    Items
                        <asp:Label runat="server" ID="CurrentPageLabel" Text="<%# Container.Owner.StartRowIndex+1%>" />
                    to
                        <asp:Label runat="server" ID="TotalPagesLabel" Text="<%# Container.Owner.TotalRowCount > (Container.Owner.StartRowIndex+Container.Owner.PageSize) ? Container.Owner.StartRowIndex+Container.Owner.PageSize : Container.Owner.TotalRowCount %>" />
                    of
                        <asp:Label runat="server" ID="TotalItemsLabel" Text="<%# Container.Owner.TotalRowCount%>" />
                    <br />
                </div>
            </PagerTemplate>
        </telerik:RadDataPagerTemplatePageField>
    </Fields>
</telerik:RadDataPager>

With this example, I have chosen to set the PageSize property to allow 10, 25, and 50 as values to select. This works just fine.

Now for my question: is there any way to allow "All" or "Maximum" to be a selectable value for the page size? My users enjoy the normal page size options, but would really benefit from having "All" or "Maximum" as a valid page size in certain circumstances.

I have tried setting the PageSize property = "10; 25; 50; All" in hopes that "All" would display as an option and that I could somehow grab the value during an event to essentially turn off paging. Unfortunately, "All" does not display; only the numeric values.

Is there a way to accomplish this? Any help is greatly appreciated!

Was it helpful?

Solution

You could try to add this item in code behind

RadDataPager1.FindControl<RadComboBox>("PageSizeComboBox").Items.Add(new RadComboBoxItem("All", RadDataPager1.TotalRowCount.ToString()));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top