/// <summary> /// Overwrites the state of the current. /// </summary> /// <param name="value">The value.</param> private void OverwriteCurrentState(ControlStateHolder value) { this.OverwriteCurrentState(string.IsNullOrEmpty(value.CurrentStateCode) ? null : this.AvailableStates.SingleOrDefault(state => state.Code == value.CurrentStateCode).InnerState); if ((this.CurrentState != null) && (this.CurrentState.Substates != null)) { foreach (Substate substate in this.CurrentState.Substates) { substate.Active = value.SubstateStatuses[substate.Code]; } } }
/// <summary> /// Saves any server control state changes that have occurred since the time the page was posted back to the server. /// </summary> /// <returns> /// Returns the server control's current state. If there is no state associated with the control, this method returns null. /// </returns> protected override object SaveControlState() { ControlStateHolder result = new ControlStateHolder(); if (this.CurrentState != null) { result.CurrentStateCode = this.CurrentState.Code; if (this.CurrentState.Substates != null) { result.SubstateStatuses = this.CurrentState.Substates.ToDictionary(substate => substate.Code, substate => substate.Active); } } return(result); }
/// <summary> /// Restores control-state information from a previous page request that was saved by the <see cref="M:System.Web.UI.Control.SaveControlState"/> method. /// </summary> /// <param name="savedState">An <see cref="T:System.Object"/> that represents the control state to be restored.</param> protected override void LoadControlState(object savedState) { if (savedState is ControlStateHolder) { ControlStateHolder controlStateHolder = (ControlStateHolder)savedState; State temporaryState = this.CurrentState; this.OverwriteCurrentState(controlStateHolder); this.BindControls(); this.restoredState = this.CurrentState; this.OverwriteCurrentState(temporaryState); } base.LoadControlState(savedState); }
/// <summary> /// Overwrites the state of the current. /// </summary> /// <param name="value">The value.</param> private void OverwriteCurrentState(ControlStateHolder value) { this.OverwriteCurrentState(string.IsNullOrEmpty(value.CurrentStateCode) ? null : this.AvailableStates.SingleOrDefault(state => state.Code == value.CurrentStateCode).InnerState); if ((this.CurrentState != null) && (this.CurrentState.Substates != null)) { foreach (Substate substate in this.CurrentState.Substates) { substate.Active = value.SubstateStatuses[substate.Code]; } } }
/// <summary> /// Saves any server control state changes that have occurred since the time the page was posted back to the server. /// </summary> /// <returns> /// Returns the server control's current state. If there is no state associated with the control, this method returns null. /// </returns> protected override object SaveControlState() { ControlStateHolder result = new ControlStateHolder(); if (this.CurrentState != null) { result.CurrentStateCode = this.CurrentState.Code; if (this.CurrentState.Substates != null) { result.SubstateStatuses = this.CurrentState.Substates.ToDictionary(substate => substate.Code, substate => substate.Active); } } return result; }