This example handles the StartSorting event to sort data in ascending order first by values of the EmployeeID
column and then by other columns:
public Form1() {
InitializeComponent();
gridControl1.DataSource = CreateTable(20);
gridView1.StartSorting += new EventHandler(gridView1_StartSorting);
}
void gridView1_StartSorting(object sender, EventArgs e) {
GridView view = sender as GridView;
GridColumn column = view.Columns["EmployeeID"];
if (checkEdit1.Checked) {
if (column.SortOrder != DevExpress.Data.ColumnSortOrder.Ascending || column.SortIndex != view.SortInfo.Count - 1) {
column.SortIndex = view.SortInfo.Count;
column.SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
}
}
else {
if (column.SortOrder != DevExpress.Data.ColumnSortOrder.Ascending || column.SortIndex != 0) {
view.SortInfo.Insert(0, new GridColumnSortInfo(column, DevExpress.Data.ColumnSortOrder.Ascending));
}
}
}
(you will be redirected to DevExpress.com to submit your response)