/// <summary> /// Stores the view state of the specified <see cref="GridView"/>. /// </summary> /// <param name="view">The view to store view state for.</param> /// <returns></returns> public ViewStateToken StoreViewState(GridView view) { if (view == null) { throw new ArgumentNullException(nameof(view)); } //Create a new ViewState. var viewState = ViewState.Create(this, view); //Store the state of the view. viewState.StoreState(view); //Add or update the ViewState for the GridView. if (!ViewStates.ContainsKey(view)) { ViewStates.Add(view, viewState); } else { ViewStates[view] = viewState; } //Create a new StateToken for this GridControlState and GridView. var token = new ViewStateToken(this, view); return(token); }
/// <summary> /// Discards the view state associated with the <see cref="ViewStateToken"/>. /// </summary> /// <param name="token">The token whose view state should be discarded.</param> internal void DiscardViewState(ViewStateToken token) { if (token == null) { throw new ArgumentNullException(nameof(token)); } DiscardViewState(token.GridView); }