private void awardGrid_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { var column = dgv_Awards.Columns[e.ColumnIndex]; Func <Award, object> orderBy = null; switch (column.Name) { case nameof(Award.Title): orderBy = a => a.Title; break; case nameof(Award.Description): orderBy = a => a.Description; break; default: return; } dgv_Awards.DataSource = null; if (Sort == SortOrder.Asc) { Sort = SortOrder.Desc; dgv_Awards.DataSource = awardBL.SortByAsc(orderBy); } else { Sort = SortOrder.Asc; dgv_Awards.DataSource = awardBL.SortByDesc(orderBy); } dgv_Awards.Columns["Id"].Visible = false; }