protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!this.Visible) { captcha = captchProvider.GetCaptcha(); Control innerCaptchaControl = captcha.GetControl(); innerCaptchaControl.Visible = false; this.Controls.Clear(); } }
protected override void OnInit(EventArgs e) { if (this.Site != null && this.Site.DesignMode) { } else { base.OnInit(e); // an exception always happens here in design mode // this try is just to fix the display in design view in VS try { captchProvider = CaptchaManager.Providers[providerName]; captcha = captchProvider.GetCaptcha(); this.Controls.Add(captcha.GetControl()); } catch { } } }
protected override void OnInit(EventArgs e) { if (this.Site != null && this.Site.DesignMode) { } else { base.OnInit(e); // an exception always happens here in design mode // this try is just to fix the display in design view in VS try { captchProvider = CaptchaManager.Providers[providerName]; captcha = captchProvider.GetCaptcha(); this.Controls.Add(captcha.GetControl()); } catch { } } }