Skip to main content

Sort Card View Data in Code

Server

To apply sorting to a column (or multiple columns), use one of the following methods.

The following sample code sorts data against the Contact Name column in ascending order.

((CardViewColumn)CardView.Columns["Contact Name"]).SortAscending();

The number of columns involved in sorting is returned by the ASPxGridBase.SortCount property. The column’s position among sorted columns is specified by the CardViewColumn.SortIndex property.

To remove sorting, do one of the following.

To clear sorting applied to ASPxCardView, call the ASPxGridBase.ClearSort method.

Client

Use the client-side ASPxClientCardView.SortBy method to sort data by the values of the specified data column.

To prevent data from being sorted by the values of particular columns, handle the ASPxClientCardView.ColumnSorting client event. The processed client column is identified by the event parameter’s column property. To cancel sorting, set the cancel property to true.