/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param> protected override void OnLoad( EventArgs e ) { base.OnLoad( e ); _personId = PageParameter( "PersonId" ).AsIntegerOrNull(); if ( !Page.IsPostBack ) { string locationId = PageParameter( "LocationId" ); if ( !string.IsNullOrWhiteSpace( locationId ) ) { ShowDetail( locationId.AsInteger(), PageParameter( "ParentLocationId" ).AsIntegerOrNull() ); } else { pnlDetails.Visible = false; } } else { // Rebuild the attribute controls on postback based on group type if ( pnlDetails.Visible ) { int? locationId = PageParameter( "LocationId" ).AsIntegerOrNull(); if ( locationId.HasValue && locationId.Value > 0 ) { var location = new LocationService(new RockContext()).Get( locationId.Value ); if ( location != null ) { location.LoadAttributes(); BuildAttributeEdits( location, true ); } } } } }