Skip to main content

DxGrid.PageSize Property

Specifies the maximum number of rows displayed on a page.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(10)]
[Parameter]
public int PageSize { get; set; }

Property Value

Type Default Description
Int32 10

The number of rows displayed on a page.

Remarks

Use the PageSize property to specify the maximum number of rows displayed on a page. If you set this property to 0 or a negative value, the Grid displays one row on each page.

You can display the page size selector that allows users to change the page size at runtime. Once a user selects a new value in this selector, the PageSize property value is updated and the Grid is redrawn.

Run Demo: Data Grid - Paging

The PageSize property is not in effect if any of following properties is set to true:

The following code snippet changes the maximum number of rows displayed on a page:

@using Microsoft.EntityFrameworkCore
@inject IDbContextFactory<NorthwindContext> NorthwindContextFactory
@implements IDisposable

<DxGrid Data="@Data" PageSize="5">
    <Columns>
        <DxGridDataColumn FieldName="ShipName" />
        <DxGridDataColumn FieldName="ShipCity" />
        <DxGridDataColumn FieldName="ShipCountry" />
        <DxGridDataColumn FieldName="Freight" />
        <DxGridDataColumn FieldName="OrderDate" />
        <DxGridDataColumn FieldName="ShippedDate" />
    </Columns>
</DxGrid>

@code {
    object Data { get; set; }
    NorthwindContext Northwind { get; set; }

    protected override void OnInitialized() {
        Northwind = NorthwindContextFactory.CreateDbContext();
        Data = Northwind.Orders.ToList();
    }

    public void Dispose() {
        Northwind?.Dispose();
    }
}

Blazor Grid Page Size

The Grid displays the vertical scrollbar when the height of the Grid content exceeds the height of the component itself. On the image below, the Grid height is limited to 300px and the PageSize property is set to 30.

Blazor Grid Vertical Scrolling

For more information about paging in the Grid component, refer to the following topic: Paging in Blazor Grid.

Implements

See Also