Show / Hide Table of Contents

    Class FieldGeneratorHandler<TModel, T>

    Base class that contains common logic for implementing field generator handlers.

    Inheritance
    System.Object
    FieldGeneratorHandler<TModel, T>
    BooleanHandler<TModel, T>
    DateTimeHandler<TModel, T>
    DefaultHandler<TModel, T>
    EnumListHandler<TModel, T>
    FileHandler<TModel, T>
    ListHandler<TModel, T>
    NumberHandler<TModel, T>
    PasswordHandler<TModel, T>
    TextAreaHandler<TModel, T>
    Implements
    IFieldGeneratorHandler<TModel, T>
    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.Handlers
    Assembly: ChameleonForms.dll
    Syntax
    public abstract class FieldGeneratorHandler<TModel, T> : IFieldGeneratorHandler<TModel, T>
    Type Parameters
    Name Description
    TModel

    The type of the model the form is being output for

    T

    The type of the property in the model that the specific field is being output for

    Constructors

    | Improve this Doc View Source

    FieldGeneratorHandler(IFieldGenerator<TModel, T>)

    Create a field generator handler.

    Declaration
    protected FieldGeneratorHandler(IFieldGenerator<TModel, T> fieldGenerator)
    Parameters
    Type Name Description
    IFieldGenerator<TModel, T> fieldGenerator

    The field generator to use

    Fields

    | Improve this Doc View Source

    FieldGenerator

    The field generator for the current field.

    Declaration
    protected readonly IFieldGenerator<TModel, T> FieldGenerator
    Field Value
    Type Description
    IFieldGenerator<TModel, T>

    Methods

    | Improve this Doc View Source

    AdjustHtmlForModelState(HtmlAttributes)

    Adjust the HTML attributes of a field based on the state of the model for that field. e.g. add validation attributes and error attributes.

    Declaration
    protected void AdjustHtmlForModelState(HtmlAttributes attrs)
    Parameters
    Type Name Description
    HtmlAttributes attrs

    The attributes to modify

    | Improve this Doc View Source

    CanHandle()

    Whether or not the current field can be output using this field generator handler.

    Declaration
    public abstract bool CanHandle()
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    GenerateFieldHtml(IReadonlyFieldConfiguration)

    Generate the HTML for the current field's Field Element using this handler.

    Declaration
    public abstract IHtmlContent GenerateFieldHtml(IReadonlyFieldConfiguration fieldConfiguration)
    Parameters
    Type Name Description
    IReadonlyFieldConfiguration fieldConfiguration

    The field configuration to use to generate the HTML

    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The HTML for the Field Element

    | Improve this Doc View Source

    GetDisplayType(IReadonlyFieldConfiguration)

    The type of control the field will be displayed as.

    Declaration
    public abstract FieldDisplayType GetDisplayType(IReadonlyFieldConfiguration fieldConfiguration)
    Parameters
    Type Name Description
    IReadonlyFieldConfiguration fieldConfiguration

    The configuration for the field

    Returns
    Type Description
    FieldDisplayType

    The display type of the field control

    | Improve this Doc View Source

    GetFieldName()

    The value to use for the full HTML name of the field.

    Declaration
    protected string GetFieldName()
    Returns
    Type Description
    System.String

    The full HTML name of the field

    | Improve this Doc View Source

    GetInputHtml(TextInputType, IReadonlyFieldConfiguration)

    Returns HTML for an <input> HTML element.

    Declaration
    protected IHtmlContent GetInputHtml(TextInputType inputType, IReadonlyFieldConfiguration fieldConfiguration)
    Parameters
    Type Name Description
    TextInputType inputType

    The type of input to produce

    IReadonlyFieldConfiguration fieldConfiguration

    The field configuration to use for attributes and format string

    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The HTML of the input element

    | Improve this Doc View Source

    GetSelectListHtml(IEnumerable<SelectListItem>, IReadonlyFieldConfiguration)

    Returns the HTML of a <select> list element. Automatically adds an empty item where appropriate.

    Declaration
    protected IHtmlContent GetSelectListHtml(IEnumerable<SelectListItem> selectList, IReadonlyFieldConfiguration fieldConfiguration)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem> selectList

    The list of items to choose from in the select list

    IReadonlyFieldConfiguration fieldConfiguration

    The field configuration to use for attributes and empty item configuration

    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent
    | Improve this Doc View Source

    PrepareFieldConfiguration(IFieldConfiguration)

    Modify the field configuration for the field using this field generator handler.

    Declaration
    public virtual void PrepareFieldConfiguration(IFieldConfiguration fieldConfiguration)
    Parameters
    Type Name Description
    IFieldConfiguration fieldConfiguration

    The field configuration to modify

    Implements

    IFieldGeneratorHandler<TModel, T>

    Extension Methods

    HtmlAttributesExtensions.ToHtmlAttributes(Object)
    • Improve this Doc
    • View Source
    Back to top © Copyright 2012-2020 MRCollective, Rob Moore, Matt Davies and the contributors to ChameleonForms.