aspnet-devexpress-dot-web-dot-gridviewdatacolumn-381bfeda.md
Clears the sorting applied to the column.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public void UnSort()
Public Sub UnSort
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>
<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();
}
Protected Sub grid_CustomCallback(ByVal sender As Object, ByVal e As ASPxGridViewCustomCallbackEventArgs)
Dim column = CType(grid.Columns("ProductName"), GridViewDataColumn)
column.UnSort()
End Sub
See Also