/// <summary> /// Restores the state of the grid view and grid view search panel. /// </summary> /// <param name="gridView">The grid view.</param> /// <param name="searchPanel">The search panel.</param> public void RestoreState( ref GridView gridView, ref GridViewSearchPanel searchPanel ) { gridView.PageIndex = this.PageIndex; gridView.PageSize = this.PageSize; searchPanel.SearchFieldName = this.SearchFieldName; searchPanel.SearchKeyword = this.SearchKeyword; searchPanel.SearchOperator = this.SearchOperator; searchPanel.Filter = this.Filter; if (!string.IsNullOrEmpty(this.SortExpression)) { gridView.Sort(this.SortExpression, this.SortDirection); } }
/// <summary> /// Sorts the <see cref="GridView"/> control based on the specified sort expression and direction. /// </summary> /// <param name="gridView">A <see cref="GridView"/> object.</param> /// <param name="sortParameterName">The <see cref="HttpRequest"/> parameter name for the sort expression.</param> /// <param name="dirParameterName">The <see cref="HttpRequest"/> parameter name for the sort direction.</param> public static void SetSortExpression(GridView gridView, String sortParameterName, String dirParameterName) { if ( !gridView.Page.IsPostBack && !gridView.Page.IsCallback && !String.IsNullOrEmpty(sortParameterName) ) { String sort = HttpContext.Current.Request[sortParameterName]; if ( !String.IsNullOrEmpty(sort) ) { SortDirection dir = SortDirection.Ascending; if ( !String.IsNullOrEmpty(dirParameterName) ) { String sortDir = HttpContext.Current.Request[dirParameterName]; if ( !String.IsNullOrEmpty(sortDir) ) { dir = (SortDirection) Enum.Parse(typeof(SortDirection), sortDir); } } gridView.Sort(sort, dir); } } }
public void ApplyGroupSort() { mGrid.Sort(this.GetSequentialGroupColumns(), groupSortDir); }