示例#1
0
        private void LoadBody(KeyValuePair <string, PropertyInfo> pair, DisplayAttribute display, List <TagBuilder> list, object value)
        {
            var tag = new TagBuilder("td");

            if (display != null && !string.IsNullOrEmpty(display.GetName()))
            {
                tag.AddCssClass(pair.Key);
                TreeTextAttribute  treeText  = pair.Value.GetCustomAttribute <TreeTextAttribute>();
                ClassNameAttribute className = pair.Value.GetCustomAttribute <ClassNameAttribute>();
                if (treeText != null)
                {
                    tag.InnerHtml = $"<label><input name=\"form-field-radio\" type=\"radio\" /><span class=\"text\">{pair.Value.GetValue(value)}</span></label> ";
                }
                else if (className != null)
                {
                    tag.InnerHtml = $"<span class='{pair.Value.GetValue(value)}'></span> ";
                }
                else
                {
                    tag.SetInnerText(pair.Value.GetValue(value).ToString());
                }
            }


            list.Add(tag);
        }
示例#2
0
        string AttributeLocator(Type type)
        {
            var classNameAttribute = new ClassNameAttribute(type.FullName);

            return(string.Format(@"[{0}(""{1}"")]", TypeToString(classNameAttribute.GetType()), type.FullName));
        }