Brew.Webforms.Widget.OnPreRender C# (CSharp) Method

OnPreRender() protected method

protected OnPreRender ( EventArgs e ) : void
e System.EventArgs
return void
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            this._scriptManager = ScriptManager.GetCurrent(this.Page);
            this._scriptManager.RegisterScriptControl<Widget>(this);

            if (this._target == null) {
                if (String.IsNullOrEmpty(this.For) && this.TagKey == HtmlTextWriterTag.Unknown) {
                    throw new ArgumentException("Brew Error: The \"for\" attribute cannot be null or empty.");
                }

                _target = this.TagKey == HtmlTextWriterTag.Unknown ? FindControl(this.For) : this;
            }

            if (this._target == null) {
                throw new ArgumentException(String.Format("Brew Error: The control with ID \"{0}\" does not exist or does not have the runat=\"server\" attribute.", this.For));
            }

            if (!this._target.Visible) {
                return;
            }

            Page.RegisterRequiresPostBack(this);
        }