/// <summary> /// Saves 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 SaveState(GridView gridView, GridViewSearchPanel searchPanel) { // Grid view values this.PageIndex = gridView.PageIndex; this.PageSize = gridView.PageSize; this.SortExpression = gridView.SortExpression; this.SortDirection = gridView.SortDirection; this.SearchFieldName = searchPanel.SearchFieldName; this.SearchOperator = searchPanel.SearchOperator; this.SearchKeyword = searchPanel.SearchKeyword; this.Filter = searchPanel.Filter; searchPanel.DataBind(); }
/// <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> /// Initializes a new instance of the <see cref="T:GridViewSearchPanelState"/> class. /// </summary> /// <param name="gridView">The grid view.</param> /// <param name="searchPanel">The search panel.</param> public GridViewSearchPanelState(GridView gridView, GridViewSearchPanel searchPanel) { SaveState(gridView, searchPanel); }