Пример #1
0
        public static string GenerateHtmlMarkupLabel(CheckBoxListItem item, string forControl)
        {
            var tagBuilder = new TagBuilder("label");

            tagBuilder.SetInnerText(item.Name);
            tagBuilder.Attributes["for"] = forControl;

            return(tagBuilder.ToString(TagRenderMode.Normal));
        }
Пример #2
0
        public static string GenerateHtmlMarkupCheckBox(CheckBoxListItem item, CheckBoxListSettings settings)
        {
            var tagBuilder = new TagBuilder("input");

            tagBuilder.MergeAttribute("id", string.Format("{0}_{1}", settings.cblName, item.Id));
            tagBuilder.MergeAttribute("type", "checkbox");
            tagBuilder.MergeAttribute("name", settings.cblName);
            tagBuilder.MergeAttribute("value", item.Id.ToString());
            if (item.Check)
            {
                tagBuilder.MergeAttribute("checked", "checked");
            }

            if (settings.Disabled)
            {
                tagBuilder.MergeAttribute("disabled", "disabled");
            }

            return(tagBuilder.ToString(TagRenderMode.SelfClosing));
        }