ChameleonForms/Component/Field.cs
/// <summary>
/// Creates a standalone form field to be output in a form.
/// </summary>
/// <example>
/// @using (var f = Html.BeginChameleonForm()) {
///     @f.FieldFor(m => m.PositionTitle)
/// }
/// </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="form">The form 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 standalone form field to be output in a form.
Creates a standalone form field to be output in a form .
public static IFieldConfiguration FieldElementFor<TModel, TTemplate, T>(this IForm<TModel, TTemplate> form, Expression<Func<TModel, T>> property) where TTemplate : IFormTemplate
        {
            var config = new FieldConfiguration();
            config.SetField(() => form.GetFieldGenerator(property).GetFieldHtml(config));
            return config;
        }
public static IFieldConfiguration FieldElementFor < TModel , TTemplate , T > ( this IForm < TModel , TTemplate > form , Expression < Func < TModel , T > > property ) where TTemplate : IFormTemplate { var config = new FieldConfiguration ( ) ; config . SetField ( ( ) => form . GetFieldGenerator ( property ) . GetFieldHtml ( config ) ) ; return config ; }
Creates a standalone form field to be output in a form.
Creates a standalone form field to be output in a form .
A field configuration object that allows you to configure the field
A field configuration object that allows you to configure the field
IForm<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
form
The form the field is being created in
The form the field is being created in
example
@using (var f = Html.BeginChameleonForm()) {
@f.FieldFor(m => m.PositionTitle)
}
@using ( var f = Html . BeginChameleonForm () ) { @f . FieldFor ( m = > m . PositionTitle ) }
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