Rock.Web.UI.Controls.LocationPicker.LoadViewState C# (CSharp) Method

LoadViewState() protected method

Restores view-state information from a previous request that was saved with the M:System.Web.UI.WebControls.WebControl.SaveViewState method.
protected LoadViewState ( object savedState ) : void
savedState object An object that represents the control state to restore.
return void
        protected override void LoadViewState( object savedState )
        {
            base.LoadViewState( savedState );

            var currentPickerMode = ViewState["CurrentPickerMode"] as LocationPickerMode?;
            if (currentPickerMode.HasValue)
            {
                this.CurrentPickerMode = currentPickerMode.Value;
            }

            var locationId = ViewState["LocationId"] as int?;
            if ( locationId.HasValue )
            {
                var location = new LocationService( new RockContext() ).Get( locationId.Value );
                if ( location != null )
                {
                    this.Location = location;
                }
            }
        }