ChameleonForms/Component/Field.cs
/// <summary>
/// Creates a standalone label to be output in a form for a field.
/// </summary>
/// <example>
/// @using (var f = Html.BeginChameleonForm()) {
///     @f.LabelFor(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 label is being created in</param>
/// <param name="property">A lamdba expression to identify the field to render the label for</param>
/// <returns>The HTML for the label</returns>
Creates a standalone label to be output in a form for a field.
Creates a standalone label to be output in a form for a field .
public static IFieldConfiguration LabelFor<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).GetLabelHtml(config));
            return config;
        }
public static IFieldConfiguration LabelFor < 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 ) . GetLabelHtml ( config ) ) ; return config ; }
Creates a standalone label to be output in a form for a field.
Creates a standalone label to be output in a form for a field .
The HTML for the label
The HTML for the label
IForm<TModel, TTemplate>
this
<not_specific>
property
Expression<Func<TModel, T>>
A lamdba expression to identify the field to render the label for
A lamdba expression to identify the field to render the label for
form
<not_specific>
The form the label is being created in
The form the label is being created in
example
@using (var f = Html.BeginChameleonForm()) {
@f.LabelFor(m => m.PositionTitle)
}
@using ( var f = Html . BeginChameleonForm () ) { @f . LabelFor ( 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