RenderControl() public static method

Renders the control which handles adding all the IRockControl common pieces (Label, Help, etc.).
public static RenderControl ( IRockControl rockControl, System.Web.UI.HtmlTextWriter writer, string additionalCssClass = "" ) : void
rockControl IRockControl The rock control.
writer System.Web.UI.HtmlTextWriter The writer.
additionalCssClass string The additional CSS class.
return void
Ejemplo n.º 1
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)
     {
         RockControlHelper.RenderControl(this, writer);
     }
 }
Ejemplo n.º 2
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)
            {
                bool renderLabel   = (!string.IsNullOrEmpty(Label));
                bool renderHelp    = (HelpBlock != null && !string.IsNullOrWhiteSpace(Help));
                bool renderWarning = (WarningBlock != null && !string.IsNullOrWhiteSpace(Warning));

                // If rendering help text with no label, the CheckBoxAdapter will need to render the help, so it needs to be temporarily
                // blanked out so that the RockControlHelper does not render it
                TemporaryHelpValue = Help;
                if (!renderLabel && renderHelp)
                {
                    Help = string.Empty;
                }

                // If rendering warning text with no label, the CheckBoxAdapter will need to render the warning, so it needs to be temporarily
                // blanked out so that the RockControlHelper does not render it
                TemporaryWarningValue = Warning;
                if (!renderLabel && renderWarning)
                {
                    Warning = string.Empty;
                }

                RockControlHelper.RenderControl(this, writer);
            }
        }
Ejemplo n.º 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(HtmlTextWriterAttribute.Class, "margin-b-md");
         RockControlHelper.RenderControl(this, writer);
     }
 }
Ejemplo n.º 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)
     {
         string required = Required ? " required" : string.Empty;
         writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-group margin-b-md js-number-up-down-group " + required);
         RockControlHelper.RenderControl(this, writer);
     }
 }
Ejemplo n.º 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)
        {
            RegisterJavaScript();

            if (this.Visible)
            {
                RockControlHelper.RenderControl(this, writer);
            }
        }
Ejemplo n.º 6
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)
            {
                // Set the required field message here because the control label may have been modified during initialization.
                this.RequiredFieldValidator.ErrorMessage = string.Format("{0} must have at least one value.", this.Label);

                RockControlHelper.RenderControl(this, writer);
            }
        }
Ejemplo n.º 7
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("class", "js-slidingdaterange-container " + this.CssClass);
                writer.RenderBeginTag("div");

                RockControlHelper.RenderControl(this, writer, "slidingdaterange");

                writer.RenderEndTag();
            }
        }
Ejemplo n.º 8
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)
     {
         if (this.MaxLength != 0 && this.ShowCountDown)
         {
             writer.AddAttribute("class", "pull-right badge");
             writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_em");
             writer.RenderBeginTag(HtmlTextWriterTag.Em);
             writer.RenderEndTag();
         }
         RockControlHelper.RenderControl(this, writer);
     }
 }
Ejemplo n.º 9
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)
            {
                if (this.StartInCodeEditorMode)
                {
                    _ceEditor.Text = this.Text;
                    this.Text      = "";
                }

                RockControlHelper.RenderControl(this, writer);
                _hfDisableVrm.RenderControl(writer);
                _hfInCodeEditorMode.RenderControl(writer);
                _ceEditor.RenderControl(writer);
            }
        }
Ejemplo n.º 10
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)
            {
                RequiredFieldValidator.InitialValue = "";
                if (_hfTemplateKey.Value.AsGuidOrNull() == _CustomGuid)
                {
                    RequiredFieldValidator.ControlToValidate = _ceLavaTemplate.ID;
                }
                else
                {
                    // override a couple of property values on RequiredFieldValidator so that Validation works correctly

                    RequiredFieldValidator.ControlToValidate = _hfTemplateKey.ID;
                }

                RockControlHelper.RenderControl(this, writer);
            }
        }
Ejemplo n.º 11
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)
            {
                if (this.StartInCodeEditorMode)
                {
                    if (_ceEditor.Text != this.Text)
                    {
                        _ceEditor.Text = this.Text;
                    }

                    // in the case of when StartInCodeEditorMode = true, we can set base.Text to string.Empty to help prevent bad html and/or javascript from messing up things
                    // However, if StartInCodeEditorMode = false, we can't do this because the WYSIWIG editor needs to know the base.Text value
                    base.Text = string.Empty;
                }

                RockControlHelper.RenderControl(this, writer);
                _hfDisableVrm.RenderControl(writer);
                _hfInCodeEditorMode.RenderControl(writer);
                _ceEditor.RenderControl(writer);
            }
        }
Ejemplo n.º 12
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)
        {
            string selectedScript = string.Empty;

            if (!string.IsNullOrWhiteSpace(OnClientSelected))
            {
                selectedScript = string.Format(@"
    acdd.onSelected = function( selectedItem ) {{
        {0}
    }}
", OnClientSelected);
            }
            string script = string.Format(@"
    var acdd = Rock.controls.autoCompleteDropDown.initialize({{ controlId: '{0}', name: '{0}', valueControlId: '{1}', url: $('#{2}').val(), idkey: $('#{3}').val(), valuekey: $('#{4}').val(), template: $('#{5}').val(), header: $('#{6}').val(), footer: $('#{7}').val(), limit: parseInt($('#{8}').val()) }});
    {9}
", this.ClientID, _hfValue.ClientID, _hfUrl.ClientID, _hfIdProperty.ClientID, _hfNameProperty.ClientID, _hfTemplate.ClientID, _hfDropdownHeader.ClientID, _hfDropdownFooter.ClientID, _hfLimit.ClientID, selectedScript);

            ScriptManager.RegisterStartupScript(this, this.GetType(), "auto-complete-drop-down-" + this.ID, script, true);

            if (this.Visible)
            {
                RockControlHelper.RenderControl(this, writer);
            }
        }