aspnet-devexpress-dot-web-dot-gridviewdatacolumn-143a48ca.md
Sorts the column in ascending order.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public void SortAscending()
Public Sub SortAscending
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();
}
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim column0 = CType(grid.Columns("Discontinued"), GridViewDataColumn)
Dim column1 = CType(grid.Columns("UnitPrice"), GridViewDataColumn)
column0.SortDescending()
column1.SortAscending()
End Sub
See Also