Skip to main content

ASPxClientGridView.ColumnSorting Event

Fires before the grid sorts its data by column values.

Declaration

ColumnSorting: ASPxClientEvent<ASPxClientGridViewColumnCancelEventHandler<ASPxClientGridView>>

Event Data

The ColumnSorting event's data class is ASPxClientGridViewColumnCancelEventArgs. The following properties provide information specific to this event:

Property Description
cancel Specifies whether to cancel the related action (for example, row edit, export). Inherited from ASPxClientCancelEventArgs.
column Gets the processed client column.

Remarks

The grid allows users to sort its data by multiple columns. When a user clicks the grid’s header to sort data, the control raises the ColumnSorting event. You can use the cancel argument property to prevent users from sorting data by the processed column.

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

<dx:ASPxGridView ID="grid" runat="server" ClientInstanceName="grid">
    <ClientSideEvents ColumnSorting="OnColumnSorting" />
    <Columns>
        <dx:GridViewDataTextColumn FieldName="ProductName" VisibleIndex="0" />
        <%--...--%>
    </Columns>
</dx:ASPxGridView>
function OnColumnSorting(s, e) {
    if(e.column.fieldName == "ProductName")
        e.cancel = true;
}
See Also