Skip to main content

DxGridDataColumn.AllowSort Property

Specifies whether users can sort data by the current column.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor


public bool? AllowSort { get; set; }

Property Value

Type Default Description
Nullable<Boolean> null

true to allow users to sort column data; otherwise, false.


The Grid component allows users to sort data as follows:

  • Click a column header to sort data in ascending order and clear sort criteria for all other columns. Subsequent clicks reverse the sort order. The sort glyph indicates the column’s current sort order.
  • Hold Shift and click column headers to sort data by multiple columns.
  • Hold Ctrl and click a column header to clear sorting by this column.

If keyboard navigation is enabled, users can focus a column header and press Space, Shift+Space, or Ctrl+Space to change sort settings. Refer to the following topic for more information on keyboard shortcuts: Keyboard Support in Blazor Grid.

Sort Data

Set the Grid’s AllowSort property to false to prevent users from sorting grid data. The column’s AllowSort property allows you to specify whether users can sort grid data by this column. Note that the value specified at the column level overrides that of the component level.


You can use the column’s SortIndex property and SortBy method to sort data in code regardless of the AllowSort property value.

The example below demonstrates how to prevent users from sorting grid data in the Ship Name column:

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

<DxGrid Data="GridDataSource">
        <DxGridDataColumn FieldName="OrderDate"
                          DisplayFormat="d" />
        <DxGridDataColumn FieldName="ShipName"
        <DxGridDataColumn FieldName="ShipCity" />
        <DxGridDataColumn FieldName="Freight"
                          DisplayFormat="n2" />

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

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

    public void Dispose() {

Run Demo: Grid - Sort Data Watch Video: Grid - Sort Data View Example: Grid - Custom Sorting

For more information about data sorting in the Grid component, refer to the following topic: Sort Data in Blazor Grid.


See Also