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

HandleModePostback() protected method

Handles the CheckedChanged event of the _radMode control.
protected HandleModePostback ( ) : void
return void
        protected void HandleModePostback()
        {
            // Note:  We have to manually wire up the PostBacks since these controls are injected into all three of the pickers and that messes up the normal postback stuff
            string eventTarget = this.Page.Request.Params["__EVENTTARGET"];
            string eventArgument = this.Page.Request.Params["__EVENTARGUMENT"];
            EnsureChildControls();

            // jump out if we this isn't an EventTarget we are expecting
            if ( eventTarget != this.UniqueID )
            {
                return;
            }

            _hfCurrentPickerMode.Value = eventArgument;

            CurrentPickerMode = _hfCurrentPickerMode.Value.ConvertToEnum<LocationPickerMode>( LocationPickerMode.Named );

            _radNamed.Checked = eventArgument == "Named";
            _radAddress.Checked = eventArgument == "Address";
            _radPoint.Checked = eventArgument == "Point";
            _radPolygon.Checked = eventArgument == "Polygon";

            _namedPicker.Visible = _radNamed.Checked;
            _namedPicker.ShowDropDown = _radNamed.Checked;

            _addressPicker.Visible = _radAddress.Checked;
            _addressPicker.ShowDropDown = _radAddress.Checked;

            _pointPicker.Visible = _radPoint.Checked;
            _pointPicker.ShowDropDown = _radPoint.Checked;

            _polygonPicker.Visible = _radPolygon.Checked;
            _polygonPicker.ShowDropDown = _radPolygon.Checked;

            if ( _radAddress.Checked )
            {
                this.CurrentPickerMode = LocationPickerMode.Address;
            }
            else if ( _radNamed.Checked )
            {
                this.CurrentPickerMode = LocationPickerMode.Named;
            }
            else if ( _radPoint.Checked )
            {
                this.CurrentPickerMode = LocationPickerMode.Point;
            }
            else if ( _radPolygon.Checked )
            {
                this.CurrentPickerMode = LocationPickerMode.Polygon;
            }
        }