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
Ejemplo n.º 1
0
        /// <summary>
        /// Writes the <see cref="T:System.Web.UI.WebControls.CompositeControl" /> content to the specified <see cref="T:System.Web.UI.HtmlTextWriter" /> object, for display on the client.
        /// </summary>
        /// <param name="writer">An <see cref="T:System.Web.UI.HtmlTextWriter" /> that represents the output stream to render HTML content on the client.</param>
        public override void RenderControl(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel panel-widget workflow-action");
            writer.AddAttribute("data-key", _hfActionTypeGuid.Value);
            writer.RenderBeginTag("article");

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "clearfix clickable panel-heading");
            writer.RenderBeginTag("header");

            // Hidden Field to track expansion
            _hfExpanded.RenderControl(writer);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "pull-left workflow-action-name");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _lblActionTypeName.Text = _tbActionTypeName.Text;
            _lblActionTypeName.RenderControl(writer);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "pull-right");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            string criteriaExistsClass = _ddlCriteriaAttribute.SelectedValueAsGuid().HasValue ? " criteria-exists" : string.Empty;

            writer.WriteLine(string.Format("<a class='btn btn-xs btn-link js-workflow-action-criteria{0}'><i class='fa fa-filter'></i></a>", criteriaExistsClass));
            writer.WriteLine("<a class='btn btn-xs btn-link workflow-action-reorder'><i class='fa fa-bars'></i></a>");
            writer.WriteLine(string.Format("<a class='btn btn-xs btn-link'><i class='workflow-action-state fa {0}'></i></a>",
                                           Expanded ? "fa fa-chevron-up" : "fa fa-chevron-down"));

            if (IsDeleteEnabled)
            {
                _lbDeleteActionType.Visible = true;

                _lbDeleteActionType.RenderControl(writer);
            }
            else
            {
                _lbDeleteActionType.Visible = false;
            }

            // Add/ChevronUpDown/Delete div
            writer.RenderEndTag();

            // header div
            writer.RenderEndTag();

            if (!Expanded)
            {
                // hide details if the name has already been filled in
                writer.AddStyleAttribute("display", "none");
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-body");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // add Criteria fields
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row conditional-run-criteria alert-warning");
            if (!_ddlCriteriaAttribute.SelectedValueAsGuid().HasValue)
            {
                writer.AddStyleAttribute("display", "none");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-lg-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-row");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-xs-7");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _ddlCriteriaAttribute.RenderControl(writer);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-xs-5");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _ddlCriteriaComparisonType.RenderControl(writer);
            writer.RenderEndTag();

            writer.RenderEndTag();  // row

            writer.RenderEndTag();  // col-md-6

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-lg-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            var comparisonType = _ddlCriteriaComparisonType.SelectedValueAsEnum <ComparisonType>();

            _tbddlCriteriaValue.Style["display"] = (comparisonType == ComparisonType.IsBlank || comparisonType == ComparisonType.IsNotBlank) ? "none" : "block";
            _tbddlCriteriaValue.RenderControl(writer);
            writer.RenderEndTag();

            writer.RenderEndTag();

            // action edit fields
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-row");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _tbActionTypeName.ValidationGroup = ValidationGroup;
            _tbActionTypeName.RenderControl(writer);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _cbIsActionCompletedOnSuccess.ValidationGroup = ValidationGroup;
            _cbIsActionCompletedOnSuccess.RenderControl(writer);
            _cbIsActivityCompletedOnSuccess.ValidationGroup = ValidationGroup;
            _cbIsActivityCompletedOnSuccess.RenderControl(writer);
            writer.RenderEndTag();

            writer.RenderEndTag();  // row

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

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-lg-4");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _wfatpEntityType.ValidationGroup = ValidationGroup;
            _wfatpEntityType.RenderControl(writer);
            writer.RenderEndTag();

            // Add an overview(description) of the selected action type
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-lg-8");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            EntityTypeCache entityType   = null;
            int?            entityTypeId = _wfatpEntityType.SelectedValueAsInt();

            if (entityTypeId.HasValue)
            {
                entityType = EntityTypeCache.Get(entityTypeId.Value);
                if (entityType != null)
                {
                    var component = ActionContainer.GetComponent(entityType.Name);
                    if (component != null)
                    {
                        string description   = string.Empty;
                        var    propAttribute = component.GetType().GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false).FirstOrDefault();
                        if (propAttribute != null)
                        {
                            var descAttribute = propAttribute as System.ComponentModel.DescriptionAttribute;
                            if (descAttribute != null)
                            {
                                _rlEntityTypeOverview.Label = string.Format("'{0}' Overview", entityType.FriendlyName);
                                _rlEntityTypeOverview.Text  = descAttribute.Description;
                                _rlEntityTypeOverview.RenderControl(writer);
                            }
                        }
                    }
                }
            }
            writer.RenderEndTag();  // col-md-8

            writer.RenderEndTag();  // row

            if (entityType != null && entityType.Name == typeof(Rock.Workflow.Action.UserEntryForm).FullName)
            {
                _formEditor.ValidationGroup = ValidationGroup;
                _formEditor.RenderControl(writer);
            }

            _phActionAttributes.RenderControl(writer);

            // widget-content div
            writer.RenderEndTag();

            // article tag
            writer.RenderEndTag();
        }
        /// <summary>
        /// Writes the <see cref="T:System.Web.UI.WebControls.CompositeControl" /> content to the specified <see cref="T:System.Web.UI.HtmlTextWriter" /> object, for display on the client.
        /// </summary>
        /// <param name="writer">An <see cref="T:System.Web.UI.HtmlTextWriter" /> that represents the output stream to render HTML content on the client.</param>
        public override void RenderControl(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel panel-widget workflow-action");
            writer.AddAttribute("data-key", _hfActionTypeGuid.Value);
            writer.RenderBeginTag("article");

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "clearfix clickable panel-heading");
            writer.RenderBeginTag("header");

            // Hidden Field to track expansion
            _hfExpanded.RenderControl(writer);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "pull-left workflow-action-name");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _lblActionTypeName.Text = _tbActionTypeName.Text;
            _lblActionTypeName.RenderControl(writer);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "pull-right");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            string criteriaExistsClass = _ddlCriteriaAttribute.SelectedValueAsGuid().HasValue ? " criteria-exists" : string.Empty;

            writer.WriteLine(string.Format("<a class='btn btn-xs btn-link js-workflow-action-criteria{0}'><i class='fa fa-filter'></i></a>", criteriaExistsClass));
            writer.WriteLine("<a class='btn btn-xs btn-link workflow-action-reorder'><i class='fa fa-bars'></i></a>");
            writer.WriteLine(string.Format("<a class='btn btn-xs btn-link'><i class='workflow-action-state fa {0}'></i></a>",
                                           Expanded ? "fa fa-chevron-up" : "fa fa-chevron-down"));

            if (IsDeleteEnabled)
            {
                _lbDeleteActionType.Visible = true;

                _lbDeleteActionType.RenderControl(writer);
            }
            else
            {
                _lbDeleteActionType.Visible = false;
            }

            // Add/ChevronUpDown/Delete div
            writer.RenderEndTag();

            // header div
            writer.RenderEndTag();

            if (!Expanded)
            {
                // hide details if the name has already been filled in
                writer.AddStyleAttribute("display", "none");
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-body");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // add Criteria fields
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row conditional-run-criteria alert-warning");
            if (!_ddlCriteriaAttribute.SelectedValueAsGuid().HasValue)
            {
                writer.AddStyleAttribute("display", "none");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-lg-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

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

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-xs-7");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _ddlCriteriaAttribute.RenderControl(writer);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-xs-5");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _ddlCriteriaComparisonType.RenderControl(writer);
            writer.RenderEndTag();

            writer.RenderEndTag();  // row

            writer.RenderEndTag();  // col-md-6

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-lg-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            var comparisonType = _ddlCriteriaComparisonType.SelectedValueAsEnum <ComparisonType>();

            _tbddlCriteriaValue.Style["display"] = (comparisonType == ComparisonType.IsBlank || comparisonType == ComparisonType.IsNotBlank) ? "none" : "block";
            _tbddlCriteriaValue.RenderControl(writer);
            writer.RenderEndTag();

            writer.RenderEndTag();

            // action edit fields
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _tbActionTypeName.ValidationGroup = ValidationGroup;
            _tbActionTypeName.RenderControl(writer);
            _ddlEntityType.ValidationGroup = ValidationGroup;
            _ddlEntityType.RenderControl(writer);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _cbIsActionCompletedOnSuccess.ValidationGroup = ValidationGroup;
            _cbIsActionCompletedOnSuccess.RenderControl(writer);
            _cbIsActivityCompletedOnSuccess.ValidationGroup = ValidationGroup;
            _cbIsActivityCompletedOnSuccess.RenderControl(writer);
            writer.RenderEndTag();

            writer.RenderEndTag();

            _formEditor.ValidationGroup = ValidationGroup;
            _formEditor.RenderControl(writer);

            _phActionAttributes.RenderControl(writer);

            // widget-content div
            writer.RenderEndTag();

            // article tag
            writer.RenderEndTag();
        }