ChameleonForms/Component/Field.cs
/// <summary>
/// Creates a single form field as a child of a form section.
/// </summary>
/// <example>
/// @s.FieldFor(m => m.FirstName)
/// </example>
/// <typeparam name="TModel">The view model type for the current view</typeparam>
/// <typeparam name="TTemplate">The type of HTML template renderer the form is using</typeparam>
/// <typeparam name="T">The type of the field being generated</typeparam>
/// <param name="section">The section the field is being created in</param>
/// <param name="property">A lamdba expression to identify the field to render the field for</param>
/// <returns>A field configuration object that allows you to configure the field</returns>
Creates a single form field as a child of a form section.
Creates a single form field as a child of a form section .
public static IFieldConfiguration FieldFor<TModel, TTemplate, T>(this Section<TModel, TTemplate> section, Expression<Func<TModel, T>> property) where TTemplate : IFormTemplate
        {
            var fc = new FieldConfiguration();
            new Field<TModel, TTemplate>(section.Form, false, section.Form.GetFieldGenerator(property), fc);
            return fc;
        }
public static IFieldConfiguration FieldFor < TModel , TTemplate , T > ( this Section < TModel , TTemplate > section , Expression < Func < TModel , T > > property ) where TTemplate : IFormTemplate { var fc = new FieldConfiguration ( ) ; new Field < TModel , TTemplate > ( section . Form , false , section . Form . GetFieldGenerator ( property ) , fc ) ; return fc ; }
Creates a single form field as a child of a form section.
Creates a single form field as a child of a form section .
// ReSharper disable ObjectCreationAsStatement // ReSharper restore ObjectCreationAsStatement
A field configuration object that allows you to configure the field
A field configuration object that allows you to configure the field
Section<TModel, TTemplate>
this
property
Expression<Func<TModel, T>>
A lamdba expression to identify the field to render the field for
A lamdba expression to identify the field to render the field for
section
The section the field is being created in
The section the field is being created in
example
@s.FieldFor(m => m.FirstName)
@s . FieldFor ( m = > m . FirstName )
typeparam
The view model type for the current view
The view model type for the current view
typeparam
The type of HTML template renderer the form is using
The type of HTML template renderer the form is using
typeparam
The type of the field being generated
The type of the field being generated