/// <summary> /// Ensures that the child controls have been built, but doesn't set control /// properties that require executing <see cref="Control.EnsureID"/> in order to avoid /// certain initialization order problems. /// </summary> /// <remarks> /// We don't just call EnsureChildControls() and then set the property on /// this.textBox itself because (apparently) setting this property in the ASPX /// page and thus calling this EnsureID() via EnsureChildControls() this early /// results in no ID. /// </remarks> protected override void EnsureChildControlsAreCreatedSafe() { if (this.selectorButton == null) { this.selectorButton = this.Buttons.OfType<SelectorInfoCardButton>().FirstOrDefault(); if (this.selectorButton != null) { var selector = this.selectorButton.InfoCardSelector; selector.ClaimsRequested.Add(new ClaimType { Name = ClaimTypes.PPID }); selector.ImageSize = InfoCardImageSize.Size60x42; selector.ReceivedToken += this.InfoCardSelector_ReceivedToken; selector.TokenProcessingError += this.InfoCardSelector_TokenProcessingError; this.Controls.Add(selector); } } base.EnsureChildControlsAreCreatedSafe(); }
/// <summary> /// Ensures that the child controls have been built, but doesn't set control /// properties that require executing <see cref="Control.EnsureID"/> in order to avoid /// certain initialization order problems. /// </summary> /// <remarks> /// We don't just call EnsureChildControls() and then set the property on /// this.textBox itself because (apparently) setting this property in the ASPX /// page and thus calling this EnsureID() via EnsureChildControls() this early /// results in no ID. /// </remarks> protected override void EnsureChildControlsAreCreatedSafe() { if (this.selectorButton == null) { this.selectorButton = this.Buttons.OfType <SelectorInfoCardButton>().FirstOrDefault(); if (this.selectorButton != null) { var selector = this.selectorButton.InfoCardSelector; selector.ClaimsRequested.Add(new ClaimType { Name = ClaimTypes.PPID }); selector.ImageSize = InfoCardImageSize.Size60x42; selector.ReceivedToken += this.InfoCardSelector_ReceivedToken; selector.TokenProcessingError += this.InfoCardSelector_TokenProcessingError; this.Controls.Add(selector); } } base.EnsureChildControlsAreCreatedSafe(); }