GridView Manual Sorting
/// /// The GridView_OnSorting event which is fired when the header of the column to sort is clicked. /// /// /// protected void gvItems_Sorting(object sender, GridViewSortEventArgs e) { try { DataTable dt = GetAllItems(); DataView dv = new DataView(dt); if (GridViewSortDirection == SortDirection.Ascending) { GridViewSortDirection = SortDirection.Descending; dv.Sort = e.SortExpression + " DESC"; } else { GridViewSortDirection = SortDirection.Ascending; dv.Sort = e.SortExpression + " ASC"; } gvItems.DataSource = dv; gvItems.DataBind(); } catch (Exception ex) { } } /// /// The GridV...