/// <summary> /// 获取所有可显示属性标签 /// </summary> /// <param name="widthLabel">是否显示Label</param> /// <returns></returns> public List <string> GetViewModelPropertyHtmlTag(bool widthLabel) { List <string> lists = new List <string>(); foreach (var item in _attribute.GetHtmlTags(false)) { if (_withValue) { if (item is DropDownListHtmlTag) { DropDownListHtmlTag tag = item as DropDownListHtmlTag; if (tag.SourceType == Constant.SourceType.ViewData && ExtendPropertyValue.ContainsKey(tag.SourceKey)) { if (ExtendPropertyValue[tag.SourceKey] is Dictionary <string, string> ) { tag.DataSource(ExtendPropertyValue[tag.SourceKey] as Dictionary <string, string>); } } } object val = ClassAction.GetObjPropertyValue(_entity, item.Name); item.SetValue(val); } lists.Add(item.ToString(widthLabel)); } return(lists); }
public List <HtmlTagBase> GetViewModelPropertyHtmlTag() { List <HtmlTagBase> results = new List <HtmlTagBase>(); foreach (var item in _attribute.GetHtmlTags(false)) { object val = ClassAction.GetObjPropertyValue(_entity, item.Name); item.SetValue(val); results.Add(item); } return(results); }
/// <summary> /// 获取对应属性的标签 /// </summary> /// <param name="property"></param> /// <returns></returns> public string GetViewModelPropertyHtmlTag(string property) { var tag = _attribute.GetHtmlTag(property); if (_withValue) { object val = ClassAction.GetObjPropertyValue(_entity, property); tag.SetValue(val); } else { tag.SetValue(null); } return(tag.ToString()); }
/// <summary> /// 获取所有隐藏控件 /// </summary> /// <returns></returns> public List <string> GetViewModelHiddenTargets() { List <string> lists = new List <string>(); foreach (var item in _attribute.GetHtmlHiddenTags()) { if (_withValue) { object val = ClassAction.GetObjPropertyValue(_entity, item.Name); item.SetValue(val); } lists.Add(item.ToString(false)); } return(lists); }