Show / Hide Table of Contents

    Class DefaultFieldGenerator<TModel, T>

    The default field HTML generator.

    Inheritance
    System.Object
    DefaultFieldGenerator<TModel, T>
    Implements
    IFieldGenerator<TModel, T>
    IFieldGenerator
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: ChameleonForms.FieldGenerators
    Assembly: ChameleonForms.dll
    Syntax
    public class DefaultFieldGenerator<TModel, T> : IFieldGenerator<TModel, T>, IFieldGenerator
    Type Parameters
    Name Description
    TModel

    The type of the view model for the form

    T

    The type of the field being generated

    Constructors

    | Improve this Doc View Source

    DefaultFieldGenerator(IHtmlHelper<TModel>, Expression<Func<TModel, T>>, IFormTemplate)

    Constructs the field generator.

    Declaration
    public DefaultFieldGenerator(IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, T>> fieldProperty, IFormTemplate template)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> htmlHelper

    The HTML helper for the current view

    System.Linq.Expressions.Expression<System.Func<TModel, T>> fieldProperty

    Expression to identify the property to generate the field for

    IFormTemplate template

    The template being used to output the form

    Properties

    | Improve this Doc View Source

    FieldProperty

    The expression that identifies the property in the model being output.

    Declaration
    public Expression<Func<TModel, T>> FieldProperty { get; }
    Property Value
    Type Description
    System.Linq.Expressions.Expression<System.Func<TModel, T>>
    | Improve this Doc View Source

    HtmlHelper

    A HTML helper for the model.

    Declaration
    public IHtmlHelper<TModel> HtmlHelper { get; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>
    | Improve this Doc View Source

    Metadata

    The metadata for the form field.

    Declaration
    public ModelMetadata Metadata { get; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata
    | Improve this Doc View Source

    Template

    The form template that will be used to render the form.

    Declaration
    public IFormTemplate Template { get; }
    Property Value
    Type Description
    IFormTemplate

    Methods

    | Improve this Doc View Source

    GetCustomAttributes()

    Returns any custom attributes against the field being generated.

    Declaration
    public IEnumerable<Attribute> GetCustomAttributes()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.Attribute>

    The attributes

    | Improve this Doc View Source

    GetFieldDisplayName()

    Returns the displayable name of the field being generated.

    Declaration
    public string GetFieldDisplayName()
    Returns
    Type Description
    System.String

    The id

    | Improve this Doc View Source

    GetFieldHtml(IFieldConfiguration)

    Creates the HTML for the field control after preparing the given field configuration.

    Declaration
    public IHtmlContent GetFieldHtml(IFieldConfiguration fieldConfiguration)
    Parameters
    Type Name Description
    IFieldConfiguration fieldConfiguration
    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The HTML for the field control

    | Improve this Doc View Source

    GetFieldHtml(IReadonlyFieldConfiguration)

    Creates the HTML for the field control.

    Declaration
    public IHtmlContent GetFieldHtml(IReadonlyFieldConfiguration fieldConfiguration)
    Parameters
    Type Name Description
    IReadonlyFieldConfiguration fieldConfiguration
    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The HTML for the field control

    | Improve this Doc View Source

    GetFieldId()

    Returns the id of the field being generated.

    Declaration
    public string GetFieldId()
    Returns
    Type Description
    System.String

    The id

    | Improve this Doc View Source

    GetLabelHtml(IFieldConfiguration)

    Creates the HTML for the field label after preparing the given field configuration.

    Declaration
    public IHtmlContent GetLabelHtml(IFieldConfiguration fieldConfiguration)
    Parameters
    Type Name Description
    IFieldConfiguration fieldConfiguration
    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The HTML for the field label

    | Improve this Doc View Source

    GetLabelHtml(IReadonlyFieldConfiguration)

    Creates the HTML for the field label.

    Declaration
    public IHtmlContent GetLabelHtml(IReadonlyFieldConfiguration fieldConfiguration)
    Parameters
    Type Name Description
    IReadonlyFieldConfiguration fieldConfiguration
    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The HTML for the field label

    | Improve this Doc View Source

    GetModel()

    Returns a model with the current values for the form.

    Declaration
    public TModel GetModel()
    Returns
    Type Description
    TModel

    The current model

    | Improve this Doc View Source

    GetValidationHtml(IFieldConfiguration)

    Creates the HTML for the field's validation messages after preparing the given field configuration.

    Declaration
    public IHtmlContent GetValidationHtml(IFieldConfiguration fieldConfiguration)
    Parameters
    Type Name Description
    IFieldConfiguration fieldConfiguration
    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The HTML for the field's validation messages

    | Improve this Doc View Source

    GetValidationHtml(IReadonlyFieldConfiguration)

    Creates the HTML for the field's validation messages

    Declaration
    public IHtmlContent GetValidationHtml(IReadonlyFieldConfiguration fieldConfiguration)
    Parameters
    Type Name Description
    IReadonlyFieldConfiguration fieldConfiguration
    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The HTML for the field's validation messages

    | Improve this Doc View Source

    GetValue()

    Returns the current value of the field.

    Declaration
    public T GetValue()
    Returns
    Type Description
    T

    The current field value

    | Improve this Doc View Source

    PrepareFieldConfiguration(IFieldConfiguration, FieldParent)

    Turns the given IFieldConfiguration into a FieldConfiguration ready to use for generating the form field.

    Declaration
    public IReadonlyFieldConfiguration PrepareFieldConfiguration(IFieldConfiguration fieldConfiguration, FieldParent fieldParent)
    Parameters
    Type Name Description
    IFieldConfiguration fieldConfiguration

    The field configuration to modify

    FieldParent fieldParent

    The parent component of the field

    Returns
    Type Description
    IReadonlyFieldConfiguration

    The readonly field configuration; ready for generating the form field

    Implements

    IFieldGenerator<TModel, T>
    IFieldGenerator

    Extension Methods

    HtmlAttributesExtensions.ToHtmlAttributes(Object)
    FieldGeneratorExtensions.HasMultipleValues<TModel, T>(IFieldGenerator<TModel, T>)
    FieldGeneratorExtensions.HasMultipleEnumValues<TModel, T>(IFieldGenerator<TModel, T>)
    FieldGeneratorExtensions.HasEnumerableValues<TModel, T>(IFieldGenerator<TModel, T>)
    FieldGeneratorExtensions.GetEnumerableValues<TModel, T>(IFieldGenerator<TModel, T>)
    FieldGeneratorExtensions.IsSelected<TModel, T>(IFieldGenerator<TModel, T>, Object)
    FieldGeneratorExtensions.GetUnderlyingType<TModel, T>(IFieldGenerator<TModel, T>)
    FieldGeneratorExtensions.IsNumeric<TModel, T>(IFieldGenerator<TModel, T>)
    FieldGeneratorExtensions.IsIntegralNumber<TModel, T>(IFieldGenerator<TModel, T>)
    FieldGeneratorExtensions.IsFloatingNumber<TModel, T>(IFieldGenerator<TModel, T>)
    • Improve this Doc
    • View Source
    Back to top © Copyright 2012-2020 MRCollective, Rob Moore, Matt Davies and the contributors to ChameleonForms.