예제 #1
0
 public Input(IHtmlHelper html, string type, PropertyContext propertyContext) : base(html, propertyContext)
 {
     Type(type);
     Id(propertyContext.Id);
     Name(propertyContext.Name);
     Value(propertyContext.Value);
 }
예제 #2
0
파일: Select.cs 프로젝트: FlukeFan/MvcForms
 public Select(IHtmlHelper html, IEnumerable <Option> options, PropertyContext propertyContext) : base(html, propertyContext)
 {
     Id(propertyContext.Id);
     Name(propertyContext.Name);
     SelectedValue(propertyContext.Values);
     Options(options);
 }
예제 #3
0
        public static GroupContext New <T>(IHtmlHelper <T> helper, PropertyContext propertyContext, string labelText)
        {
            var modelState = propertyContext.ModelState;

            var hasErrors = modelState != null &&
                            modelState.Errors != null &&
                            modelState.Errors.Count > 0;

            return(new GroupContext
            {
                Property = propertyContext,
                LabelText = labelText,
                HasErrors = hasErrors,
            });
        }
예제 #4
0
        public static Input InputNumber <T>(this IHtmlHelper <T> helper, Expression <Func <T, int> > property)
        {
            var propertyContext = PropertyContext.New(helper, property);

            return(new Input(helper, "number", propertyContext));
        }
예제 #5
0
        public static Input InputText <T>(this IHtmlHelper <T> helper, Expression <Func <T, string> > property)
        {
            var propertyContext = PropertyContext.New(helper, property);

            return(new Input(helper, "text", propertyContext));
        }
예제 #6
0
        public static Input InputHidden <TModel, TValue>(this IHtmlHelper <TModel> helper, Expression <Func <TModel, TValue> > property)
        {
            var propertyContext = PropertyContext.New <TModel, TValue>(helper, property);

            return(new Input(helper, "hidden", propertyContext));
        }
예제 #7
0
        public static Select Select <T, U>(this IHtmlHelper <T> helper, Expression <Func <T, U> > property, IEnumerable <Option> options)
        {
            var propertyContext = PropertyContext.New(helper, property);

            return(new Select(helper, options, propertyContext).Multiple(propertyContext.IsList));
        }
예제 #8
0
 public PropertyControl(IHtmlHelper html, PropertyContext propertyContext) : base(html)
 {
     PropertyContext = propertyContext;
 }