Revision: 58069
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 23, 2012 04:52 by mattvbiggs
Initial Code
SortDirection sortdir = SortDirection.Ascending; if (ViewState["SortDirection"] != null) { if ((string)ViewState["sortexp"] == e.SortExpression) { sortdir = (SortDirection)ViewState["SortDirection"] == SortDirection.Ascending ? SortDirection.Descending : SortDirection.Ascending; } } string sortexp = e.SortExpression; ViewState["sortexp"] = sortexp; ViewState["SortDirection"] = sortdir; fill_grid();
Initial URL
Initial Description
When I first used this code, it was in the GridView_OnSorting event. This will sort the Sort Expression and Sort Direction in the ViewState. In the fill_grid() function I will pull these values from the ViewState to construct the sort.
Initial Title
Toggle Asc/Desc Sorting Gridview Columns
Initial Tags
Initial Language
C#