GridViewDataColumn.SortAscending() Method
Sorts the column in ascending order.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.1.dll
NuGet Package: DevExpress.Web
Declaration
Remarks
When you call the SortAscending()
or SortDescending() method, the grid sorts the column in ascending or descending order and sets its SortOrder property to the corresponding value.
For more information on sorting in the grid, refer to the following topic: ASPxGridView - Sort Data.
<dx:ASPxGridView ID="grid" runat="server" AutoGenerateColumns="False" KeyFieldName="ProductID">
<Columns>
<dx:GridViewDataTextColumn FieldName="ProductName" VisibleIndex="0" />
<dx:GridViewDataTextColumn FieldName="UnitPrice" VisibleIndex="1" />
<dx:GridViewDataTextColumn FieldName="UnitsInStock" VisibleIndex="2" />
<dx:GridViewDataCheckColumn FieldName="Discontinued" VisibleIndex="3" />
<dx:GridViewDataTextColumn FieldName="UnitsOnOrder" VisibleIndex="4" />
</Columns>
</dx:ASPxGridView>
protected void Page_Load(object sender, EventArgs e) {
var column0 = (GridViewDataColumn)grid.Columns["Discontinued"];
var column1 = (GridViewDataColumn)grid.Columns["UnitPrice"];
column0.SortDescending();
column1.SortAscending();
}
See Also