Skip to main content
Tab

GridViewDataColumn.UnSort() Method

Clears the sorting applied to the column.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public void UnSort()

Remarks

When you call the UnSort method, the grid behaves as follows:

  • Clears the sorting by the specified column.

  • Sets the SortIndex property to -1.

  • Sets the SortOrder property to None.

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

<dx:ASPxGridView ID="grid" ClientInstanceName="grid" runat="server" AutoGenerateColumns="False"
    KeyFieldName="ProductID" OnCustomCallback="grid_CustomCallback">
    <Columns>
        <dx:GridViewDataTextColumn FieldName="ProductName" VisibleIndex="0" SortIndex="0" SortOrder="Ascending" />
        <dx:GridViewDataTextColumn FieldName="UnitPrice" VisibleIndex="1" SortIndex="1" SortOrder="Descending" />
        <dx:GridViewDataTextColumn FieldName="UnitsInStock" VisibleIndex="2" SortIndex="2" SortOrder="Ascending" />
        <dx:GridViewDataCheckColumn FieldName="Discontinued" VisibleIndex="3" />
        <dx:GridViewDataTextColumn FieldName="UnitsOnOrder" VisibleIndex="4" />
    </Columns>
</dx:ASPxGridView>
<br />
<dx:ASPxButton ID="button" runat="server" Text="Custom action" AutoPostBack="false">
    <ClientSideEvents Click="OnClick" />
</dx:ASPxButton>
function OnClick(s, e) {
    grid.PerformCallback();
}
protected void grid_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) {
    var column = (GridViewDataColumn)grid.Columns["ProductName"];
    column.UnSort();
}
See Also