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
Property Value
Type | Default | Description |
---|---|---|
Int32 | -1 | The column’s sort priority. |
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>