protected void SortRecords(object sender, GridViewSortEventArgs e) { var sortExpression = e.SortExpression; string direction; if (SortDirection == SortDirection.Ascending) { SortDirection = SortDirection.Descending; direction = "descending"; } else { SortDirection = SortDirection.Ascending; direction = "ascending"; } var administrators = Administrator.FindAll().Sort(ref sortExpression, ref direction, "ManagerName").ToList(); Administrators.DataSource = administrators; Administrators.DataBind(); }