/ Published in: C#
When I first used this code, it was in the GridViewOnSorting event. This will sort the Sort Expression and Sort Direction in the ViewState. In the fillgrid() function I will pull these values from the ViewState to construct the sort.
Expand |
Embed | Plain Text
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();
You need to login to post a comment.
