GridControlSort

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

Given below is a sample screen shot.

GridControlSort screenshot

GridControlSort

    		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());