Skip to main content
Tab

GridViewDataColumn.SortIndex Property

Specifies the column’s sort priority among columns (a lower number indicates a higher priority).

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

[DefaultValue(-1)]
public int SortIndex { get; set; }

Property Value

Type Default Description
Int32 -1

The column’s sort priority.
-1 if the grid does not sort its data by the column.

Remarks

ASPxGridView allows users to sort its data by multiple columns. Use the SortIndex property to define the column’s sort priority among columns.

When you change the SortIndex property value, the control automatically sets the column’s SortOrder property to Ascending.

If the SortIndex property is set to -1, the control does not sort its data by this column.

For more information on sorting in the grid, refer to the following topic: ASPxGridView - Sort Data.

<dx:ASPxGridView ID="grid" runat="server" KeyFieldName="CustomerID" AutoGenerateColumns="false">
    <Columns>
        <dx:GridViewDataColumn FieldName="ContactName" SortIndex="0" />
        <dx:GridViewDataColumn FieldName="CompanyName" SortIndex="1" />
        <dx:GridViewDataColumn FieldName="City" />
        <dx:GridViewDataColumn FieldName="Region" />
        <dx:GridViewDataColumn FieldName="Country" SortIndex="2" />
    </Columns>
</dx:ASPxGridView>

Run Demo: ASPxGridView - Customization Dialog (Web Forms)

Run Demo: GridView - Customization Dialog (MVC)

See Also