RenderControl() public method

Outputs server control content to a provided T:System.Web.UI.HtmlTextWriter object and stores tracing information about the control if tracing is enabled.
public RenderControl ( System.Web.UI.HtmlTextWriter writer ) : void
writer System.Web.UI.HtmlTextWriter The object that receives the control content.
return void
コード例 #1
0
        /// <summary>
        /// This is where you implement the simple aspects of rendering your control.  The rest
        /// will be handled by calling RenderControlHelper's RenderControl() method.
        /// </summary>
        /// <param name="writer">The writer.</param>
        public override void RenderBaseControl(HtmlTextWriter writer)
        {
            base.RenderBaseControl(writer);

            // don't show the PageRoutePicker if this control is not enabled (readonly)
            if (this.Enabled)
            {
                // this might be a PagePicker where we don't want them to choose a PageRoute (for example, the PageRoute detail block)
                if (PromptForPageRoute)
                {
                    _hfPageRouteId.RenderControl(writer);

                    _btnShowPageRoutePicker.RenderControl(writer);

                    writer.Write(string.Format(@"<div id='page-route-picker_{0}' class='picker'>", this.ClientID));
                    writer.Write(@"<div class='picker-menu picker dropdown-menu js-page-route-picker-menu'>");

                    _rblSelectPageRoute.RenderControl(writer);

                    writer.Write(@"<div class='picker-actions'>");

                    _btnSelectPageRoute.RenderControl(writer);
                    writer.WriteLine();
                    _btnCancelPageRoute.RenderControl(writer);
                    writer.Write("</div>");
                    writer.Write(@"</div>");
                    writer.Write(@"</div>");

                    RegisterPageRoutePickerJavaScript();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// This is where you implement the simple aspects of rendering your control.  The rest
        /// will be handled by calling RenderControlHelper's RenderControl() method.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        public void RenderBaseControl(HtmlTextWriter writer)
        {
            var showAges = false;

            _maxAgeUnit.SelectedValue       = TimeIntervalUnit.Minutes.ConvertToInt().ToString();
            _maxSharedAgeUnit.SelectedValue = TimeIntervalUnit.Minutes.ConvertToInt().ToString();

            if (CurrentCacheablity == null)
            {
                _cacheabilityType.SelectedValue = RockCacheablityType.Public.ConvertToInt().ToString();
                showAges = true;
            }
            else
            {
                showAges = CurrentCacheablity.OptionSupportsAge(CurrentCacheablity.RockCacheablityType);
                _cacheabilityType.SelectedValue = CurrentCacheablity.RockCacheablityType.ConvertToInt().ToString();

                _maxAgeValue.Text = CurrentCacheablity.MaxAge?.Value.ToStringSafe();
                if (CurrentCacheablity.MaxAge != null)
                {
                    _maxAgeUnit.SelectedValue = CurrentCacheablity.MaxAge.Unit.ConvertToInt().ToStringSafe();
                }

                _maxSharedAgeValue.Text = CurrentCacheablity.SharedMaxAge?.Value.ToStringSafe();
                if (CurrentCacheablity.SharedMaxAge != null)
                {
                    _maxSharedAgeUnit.SelectedValue = CurrentCacheablity.SharedMaxAge?.Unit.ConvertToInt().ToStringSafe();
                }
            }

            _cacheabilityType.Enabled  = Enabled;
            _maxAgeUnit.Enabled        = Enabled;
            _maxAgeValue.Enabled       = Enabled;
            _maxSharedAgeUnit.Enabled  = Enabled;
            _maxSharedAgeValue.Enabled = Enabled;

            writer.AddAttribute(HtmlTextWriterAttribute.Style, Style.Value);
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            _cacheabilityType.RenderControl(writer);

            if (showAges)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "row");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _maxAgeLabel.RenderControl(writer);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "input-group d-flex");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _maxAgeValue.RenderControl(writer);
                _maxAgeUnit.RenderControl(writer);
                writer.RenderEndTag();
                writer.RenderEndTag();

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _maxSharedAgeLabel.RenderControl(writer);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "input-group d-flex");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _maxSharedAgeValue.RenderControl(writer);
                _maxSharedAgeUnit.RenderControl(writer);
                writer.RenderEndTag();
                writer.RenderEndTag();

                writer.RenderEndTag();
            }

            writer.RenderEndTag();
        }
コード例 #3
0
        /// <summary>
        /// Outputs server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter" /> object and stores tracing information about the control if tracing is enabled.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param>
        public override void RenderControl(HtmlTextWriter writer)
        {
            if (this.Visible)
            {
                writer.AddAttribute("rowid", ID);
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);

                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-group" + (_rblRole.IsValid ? "" : " has-error"));
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _rblRole.RenderControl(writer);
                writer.RenderEndTag();
                writer.RenderEndTag();

                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                _ddlTitle.RenderControl(writer);
                writer.RenderEndTag();

                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-group" + (_tbFirstName.IsValid ? "" : " has-error"));
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _tbFirstName.RenderControl(writer);
                writer.RenderEndTag();
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-group" + (_tbLastName.IsValid ? "" : " has-error"));
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _tbLastName.RenderControl(writer);
                writer.RenderEndTag();
                writer.RenderEndTag();

                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                _ddlSuffix.RenderControl(writer);
                writer.RenderEndTag();

                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                _ddlConnectionStatus.RenderControl(writer);
                writer.RenderEndTag();

                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-group" + (_rblGender.IsValid ? "" : " has-error"));
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _rblGender.RenderControl(writer);
                writer.RenderEndTag();
                writer.RenderEndTag();

                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                _dpBirthdate.RenderControl(writer);
                writer.RenderEndTag();

                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                if (ShowGrade)
                {
                    _ddlGradePicker.RenderControl(writer);
                }

                writer.RenderEndTag();

                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                _lbDelete.RenderControl(writer);
                writer.RenderEndTag();

                writer.RenderEndTag();
            }
        }
コード例 #4
0
        /// <summary>
        /// Outputs server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter" /> object and stores tracing information about the control if tracing is enabled.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param>
        public override void RenderControl(HtmlTextWriter writer)
        {
            if (this.Visible)
            {
                writer.AddAttribute("rowid", ID);
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);

                writer.AddAttribute("data-label", "Role");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-group" + (_rblRole.IsValid ? "" : " has-error"));
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _rblRole.RenderControl(writer);
                writer.RenderEndTag();
                writer.RenderEndTag();

                if (this.ShowTitle)
                {
                    writer.AddAttribute("data-label", "Title");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    _dvpTitle.RenderControl(writer);
                    writer.RenderEndTag();
                }

                writer.AddAttribute("data-label", "Name");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-group" + (_tbFirstName.IsValid ? "" : " has-error"));
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _tbFirstName.RenderControl(writer);
                writer.RenderEndTag();

                if (this.ShowNickName)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-group" + (_tbNickName.IsValid ? "" : " has-error"));
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    _tbNickName.RenderControl(writer);
                    writer.RenderEndTag();
                }

                if (this.ShowMiddleName)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-group" + (_tbMiddleName.IsValid ? "" : " has-error"));
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    _tbMiddleName.RenderControl(writer);
                    writer.RenderEndTag();
                }

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-group" + (_tbLastName.IsValid ? "" : " has-error"));
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _tbLastName.RenderControl(writer);
                writer.RenderEndTag();

                writer.RenderEndTag();

                if (this.ShowSuffix)
                {
                    writer.AddAttribute("data-label", "Suffix");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    _dvpSuffix.RenderControl(writer);
                    writer.RenderEndTag();
                }

                writer.AddAttribute("data-label", "Connection Status");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                _dvpConnectionStatus.RenderControl(writer);
                writer.RenderEndTag();

                writer.AddAttribute("data-label", "Gender");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-group" + (_rblGender.IsValid ? "" : " has-error"));
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _rblGender.RenderControl(writer);
                writer.RenderEndTag();
                writer.RenderEndTag();

                writer.AddAttribute("data-label", "Birthdate");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-group" + (_dpBirthdate.IsValid ? "" : " has-error"));
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _dpBirthdate.RenderControl(writer);
                writer.RenderEndTag();
                writer.RenderEndTag();

                if (ShowGradeColumn)
                {
                    writer.AddAttribute("data-label", "Grade");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    if (ShowGradePicker)
                    {
                        _ddlGradePicker.RenderControl(writer);
                    }
                    writer.RenderEndTag();
                }

                writer.AddAttribute("data-label", "Cancel");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                _lbDelete.RenderControl(writer);
                writer.RenderEndTag();

                writer.RenderEndTag();
            }
        }
コード例 #5
0
        /// <summary>
        /// Outputs server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter" /> object and stores tracing information about the control if tracing is enabled.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> object that receives the control content.</param>
        public override void RenderControl(HtmlTextWriter writer)
        {
            if (this.Visible)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "pull-right");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _lbDelete.RenderControl(writer);
                writer.RenderEndTag();

                writer.RenderBeginTag(HtmlTextWriterTag.H4);
                writer.Write(Caption);
                writer.RenderEndTag();

                // Relationship
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "row");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, GetColumnStyle(6));
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _ddlRelationshipType.RenderControl(writer);
                writer.RenderEndTag();
                writer.AddAttribute(HtmlTextWriterAttribute.Class, GetColumnStyle(6));     // filler/blocker column
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                writer.RenderEndTag();
                writer.RenderEndTag(); // end Relationship row

                writer.AddAttribute("rowid", ID);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "row clearfix");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                bool existingPerson = (this.PersonId > 0);
                _lNickName.Visible  = existingPerson;
                _lLastName.Visible  = existingPerson;
                _tbNickName.Visible = !existingPerson;
                _tbLastName.Visible = !existingPerson;

                writer.AddAttribute(HtmlTextWriterAttribute.Class, GetColumnStyle(3));
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _lNickName.RenderControl(writer);
                _tbNickName.RenderControl(writer);
                writer.RenderEndTag();

                writer.AddAttribute(HtmlTextWriterAttribute.Class, GetColumnStyle(3));
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                _lLastName.RenderControl(writer);
                _tbLastName.RenderControl(writer);
                writer.RenderEndTag();

                if (this.ShowGender)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, GetColumnStyle(3));
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    _ddlGender.RenderControl(writer);
                    writer.RenderEndTag();
                }

                if (this.ShowSuffix)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, GetColumnStyle(3));
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    _ddlSuffix.RenderControl(writer);
                    writer.RenderEndTag();
                }

                if (this.ShowBirthDate)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, GetColumnStyle(6));
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    _bpBirthdate.RenderControl(writer);
                    writer.RenderEndTag();
                }

                if (this.ShowGrade)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, GetColumnStyle(3));
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    _ddlGradePicker.RenderControl(writer);
                    writer.RenderEndTag();
                }

                if (this.ShowMobilePhone)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, GetColumnStyle(3));
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    _pnbMobile.RenderControl(writer);
                    writer.RenderEndTag();
                }

                if (this.ShowEmailAddress)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, GetColumnStyle(6));
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    _ebEmail.RenderControl(writer);
                    writer.RenderEndTag();
                }

                if (this.ShowCommunicationPreference)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, GetColumnStyle(6));
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    _rblCommunicationPreference.RenderControl(writer);
                    writer.RenderEndTag();
                }

                foreach (Control attributeCtrl in _phAttributes.Controls)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, GetColumnStyle(3));
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    attributeCtrl.RenderControl(writer);
                    writer.RenderEndTag();
                }

                writer.RenderEndTag();

                writer.RenderBeginTag(HtmlTextWriterTag.Hr);
                writer.RenderEndTag();
            }
        }