Ejemplo n.º 1
0
        public static string Button(string caption, string @class, BootcssButton buttonType, bool block,
                                    IEnumerable <HtmlAttribute> attributes)
        {
            TkDebug.AssertArgumentNullOrEmpty(caption, "caption", null);
            HtmlAttributeBuilder builder = new HtmlAttributeBuilder();
            string totalClass            = GetTotalClass(@class, buttonType, block);

            builder.Add("type", "button");
            builder.Add("class", totalClass);
            builder.AddRange(attributes);

            return(string.Format(ObjectUtil.SysCulture, "<button {1}>{0}</button>", caption,
                                 builder.CreateAttribute()));
        }
Ejemplo n.º 2
0
        private static void AddNormalAttribute(Tk5FieldInfoEx field, HtmlAttributeBuilder builder,
                                               string name, bool needId, bool isHidden = false)
        {
            if (needId)
            {
                builder.Add("id", name);
            }
            builder.Add("name", name);
            string editClass = field.Edit == null ? null : field.Edit.Class;

            if (!isHidden)
            {
                builder.Add("class", HtmlCommonUtil.MergeClass("form-control", editClass));
                builder.Add("data-title", field.DisplayName);
            }
            else if (!string.IsNullOrEmpty(editClass))
            {
                builder.Add("class", editClass);
            }
            if (field.Edit != null)
            {
                builder.AddRange(field.Edit.AttributeList);
            }
        }