public HtmlElement(HtmlHelper <T> helper, Expression <Func <T, TValue> > exp) { Helper = helper; MemberExpression ex = (MemberExpression)exp.Body; MemberName = GetMemberName(ex); ModelName = GetModelName(); GroupModel = new NgControlGroup { Label = GetLabel(typeof(T).Name, MemberName) }; InputModel = new NgInput { MemberName = MemberName, NgModelName = ModelName }; }
public virtual void UseProperty(string memberName, string columnId, string propertyName, bool useGroup = true) { ColumnId = columnId; string groupName = useGroup ? "FG_" + memberName.Replace(".", "_") : null; InputModel = new NgInput { MemberName = memberName, NgModelName = Helper.GetModelName(), NgFormName = Helper.GetFormName(), EntityPropertyName = propertyName, GroupName = groupName }; GroupModel = new NgControlGroup { Label = TextProvider.Column(ColumnId), Name = groupName, PropertyName = InputModel.MemberName.GetAfterLast(".").UCFirst() }; Helper.AddText(StringType.Column, columnId); }
public override void UseExpression <T, TValue>(Expression <Func <T, TValue> > exp) { ColumnId = RazorUtils.GetColumnId(exp); MemberExpression = RazorUtils.GetMemberExpression(exp); string groupName = "FG_" + RazorUtils.GetMemberName(exp).Replace(".", "_"); InputModel = new NgInput { MemberName = RazorUtils.GetMemberName(exp), NgModelName = Helper.GetModelName(), NgFormName = Helper.GetFormName(), GroupName = groupName }; GroupModel = new NgControlGroup { Label = TextProvider.Column(ColumnId), Name = groupName, PropertyName = RazorUtils.GetMemberNameDefault(exp).GetAfterLast(".") }; Helper.AddText(StringType.Column, ColumnId); }