Unplanned
Last Updated: 29 Jul 2025 06:17 by ADMIN
Toni
Created on: 18 Apr 2020 11:05
Category: Grid
Type: Feature Request
22
Add PageSize to the grid state
Hi, How can i store and retrieve the PageSize of a Grid in the GridState? It seems that this is missing in GridState?
11 comments
ADMIN
Dimo
Posted on: 29 Jul 2025 06:17

@Denny

>> if you need to show me a list at least make it a list of things requested that have not been completed....

My previous reply contains that list too: https://feedback.telerik.com/blazor?listMode=Popular&typeId=2&categoryId=1992&statusId=4

There are currently two ways to obtain the Grid page size without having it in the Grid state:

Let me know if you need more information.

@using Telerik.DataSource
@using Telerik.DataSource.Extensions

<p>Grid Page Size from parameter: <strong>@GridPageSize</strong></p>
<p>Grid Page Size from OnRead event: <strong>@GridPageSizeFromOnRead</strong></p>

<TelerikGrid OnRead="@OnGridRead"
             TItem="@Product"
             FilterMode="GridFilterMode.FilterRow"
             Pageable="true"
             @bind-PageSize="@GridPageSize"
             Sortable="true"
             Height="400px">
    <GridSettings>
        <GridPagerSettings PageSizes="@( new List<int?> { null, 10, 20, 50 } )" />
    </GridSettings>
    <GridColumns>
        <GridColumn Field="@nameof(Product.Name)" />
        <GridColumn Field="@nameof(Product.Group)" />
        <GridColumn Field="@nameof(Product.Price)" DisplayFormat="{0:c2}" />
        <GridColumn Field="@nameof(Product.Quantity)" DisplayFormat="{0:n0}" />
        <GridColumn Field="@nameof(Product.Released)" DisplayFormat="{0:d}" />
        <GridColumn Field="@nameof(Product.Discontinued)" />
    </GridColumns>
</TelerikGrid>

@code {
    private List<Product> GridData { get; set; } = new();

    private int GridPageSize { get; set; } = 10;
    private int GridPageSizeFromOnRead { get; set; }

    private async Task OnGridRead(GridReadEventArgs args)
    {
        GridPageSizeFromOnRead = args.Request.PageSize;

        DataSourceResult result = await GridData.ToDataSourceResultAsync(args.Request);

        args.Data = result.Data;
        args.Total = result.Total;
        args.AggregateResults = result.AggregateResults;
    }

    protected override void OnInitialized()
    {
        var rnd = Random.Shared;

        for (int i = 1; i <= 77; i++)
        {
            GridData.Add(new Product()
            {
                Id = i,
                Name = $"Name {i} {(char)rnd.Next(65, 91)}{(char)rnd.Next(65, 91)}",
                Group = $"Group {i % 3 + 1}",
                Price = rnd.Next(1, 100) * 1.23m,
                Quantity = rnd.Next(0, 10000),
                Released = DateTime.Today.AddDays(-rnd.Next(60, 1000)),
                Discontinued = i % 4 == 0
            });
        }
    }

    public class Product
    {
        public int Id { get; set; }
        public string Name { get; set; } = string.Empty;
        public string Group { get; set; } = string.Empty;
        public decimal Price { get; set; }
        public int Quantity { get; set; }
        public DateTime Released { get; set; }
        public bool Discontinued { get; set; }
    }
}

 

Regards,
Dimo
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Pingu
Posted on: 28 Jul 2025 20:59

@Denny This is hitting my email as its an issue I voted on, and I haven't used Telerik in years. From time to time I get updates on other issues I posted / voted on also.

Its genuinely insane to me how slowly things get fixed etc when there are blatant issues with Telerik Blazor UI, which is a big part of why I stopped using Telerik.

 

Not super helpful unfortunately, but my ultimate advice is that if there are issues with Telerik that are important enough to you, your best bet is looking elsewhere.

Denny
Posted on: 28 Jul 2025 15:08

and the comment from admin gives me a list of requested features that goes back and lists completed features over 4 years old....

if you need to show me a list at least make it a list of things requested that have not been completed....

 

but that still leaves the same problem, page size *IS* part of the "State" of the grid.  page number  is in that state.

without the page size the page number is almost of no use or value.

to go to "Page #x" you need to be able to setup a data query that knows how many rows to skip which is based on page size.

i am not doing that right now but that is one of the ways the current grid state is lacking.

for now i am having to capture the size and page size changes so that i can add this to the state data.

so i do have a work around for this but this has been requested for over 5 years now...

 

ADMIN
Dimo
Posted on: 28 Jul 2025 10:34

Hi Denny,

I understand your point of view and the urge to have a PageSize property in the Grid state. I can add two quick notes on the matter:

Regards,
Dimo
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Denny
Posted on: 25 Jul 2025 18:10

so it looks like from 2020 to 2025 this has been requested and not done.... ok i get it this is a big thing to ask for to add 1 int to the grid state - wow thats hard!

I also see the first comment in this from 2020 saying that it was not a thing the user could select, that is not true today....

also the grid state save the page number and a skip value but without the page size they are not useable.

seems like this should be re-evaluated and implemented ,,,,

Joe
Posted on: 28 Jan 2025 23:35
Please do add the PageSize to the GridState object.  Having to manually persist this to Local Storage seems an unnecessary workaround.
ADMIN
Dimo
Posted on: 24 Oct 2023 12:07

Hello Ryan,

For the time being, I confirm that we are focusing on other tasks. When we schedule this one for implementation, its status will change and you will receive a notification (I assume that you are following it).

In the meantime, I hope it's feasible to save and restore the PageSize separately.

Regards,
Dimo
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources!
Ryan
Posted on: 23 Oct 2023 20:05
Hello, is there any update on this feature request to store page size in the grid state? This would be very helpful.
ADMIN
Dimo
Posted on: 01 Apr 2022 18:06

Hi Timothy,

The Grid now allows the user to change the PageSize, so I agree the feature request is now more applicable than when it was submitted. We will prioritize it depending on customer demand.

In the meantime, it is possible to serialize and save separately additional Grid information (which is not in the state) and then restore it programmatically.

Regards,
Dimo
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Timothy J
Posted on: 31 Mar 2022 12:44
>>

The PageSize of the grid is not something the user can change through the grid UI and as such it is not part of its state. Nevertheless, I can see value in it being added to the state.

<<

 

It does store the Page, though.  Without the PageSize, the current Page is almost meaningless.
ADMIN
Marin Bratanov
Posted on: 18 Apr 2020 11:07

The PageSize of the grid is not something the user can change through the grid UI and as such it is not part of its state. Nevertheless, I can see value in it being added to the state.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.