Sorting Demo

Sorting is directly supported in a GridDataBoundGrid based on the grids in the underlying data table. For grid control-based grids, this sample will show you how to implement header-click sorting in your grid. The header cell draws a sort icon to indicate that the column has been sorted in a particular direction.

The following screenshot illustrates this.

GridControlSort screenshot

Features

    		this.gridControl1.CellModels.Add("ColumnHeaderCell", new GridSortColumnHeaderCellModel(this.gridControl1.Model));
    		this.gridControl1[0, col].CellType = "ColumnHeaderCell";  

    		ListSortDirection dir = ListSortDirection.Ascending;
    		this.gridControl1[0, col].Tag = dir;  

    		this.gridControl1.Data.SortByColumn(col, dir, new FormulaComparer());