Show / Hide Table of Contents

    Class Form<TModel>

    Default Chameleon Form implementation.

    Inheritance
    System.Object
    Form<TModel>
    Implements
    IForm<TModel>
    IForm
    System.IDisposable
    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
    Assembly: ChameleonForms.dll
    Syntax
    public class Form<TModel> : IForm<TModel>, IForm, IDisposable
    Type Parameters
    Name Description
    TModel

    Constructors

    | Improve this Doc View Source

    Form(IHtmlHelper<TModel>, IFormTemplate, String, FormMethod, HtmlAttributes, Nullable<EncType>, Nullable<Boolean>)

    Construct a Chameleon Form. Note: Contains a call to the virtual method Write.

    Declaration
    public Form(IHtmlHelper<TModel> helper, IFormTemplate template, string action, FormMethod method, HtmlAttributes htmlAttributes, EncType? enctype, bool? outputAntiforgeryToken)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> helper

    The HTML Helper for the current view

    IFormTemplate template

    A template renderer instance to use to render the form

    System.String action

    The action the form should submit to

    Microsoft.AspNetCore.Mvc.Rendering.FormMethod method

    The HTTP method the form submission should use

    HtmlAttributes htmlAttributes

    Any HTML attributes the form should use expressed as an anonymous object

    System.Nullable<EncType> enctype

    The encoding type the form submission should use

    System.Nullable<System.Boolean> outputAntiforgeryToken

    Whether or not to output an antiforgery token in the form; defaults to null which will output a token if the method isn't GET

    Properties

    | Improve this Doc View Source

    HtmlHelper

    The HTML helper for the current view.

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

    Template

    The template renderer for the current view.

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

    Methods

    | Improve this Doc View Source

    CreatePartialForm(IHtmlHelper<TModel>)

    Returns a wrapped ChameleonForms.PartialViewForm`1 for the given partial view helper.

    Declaration
    public IForm<TModel> CreatePartialForm(IHtmlHelper<TModel> partialViewHelper)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> partialViewHelper

    The HTML Helper from the partial view

    Returns
    Type Description
    IForm<TModel>

    The PartialViewForm wrapping the original form

    | Improve this Doc View Source

    CreatePartialForm<TPartialModel>(LambdaExpression, IHtmlHelper<TPartialModel>)

    Returns a wrapped ChameleonForms.PartialViewForm`2 for the given partial view information.

    Declaration
    public IForm<TPartialModel> CreatePartialForm<TPartialModel>(LambdaExpression partialModelExpression, IHtmlHelper<TPartialModel> partialViewHelper)
    Parameters
    Type Name Description
    System.Linq.Expressions.LambdaExpression partialModelExpression

    The expression that identifies the partial model

    Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TPartialModel> partialViewHelper

    The HTML Helper from the partial view

    Returns
    Type Description
    IForm<TPartialModel>

    The PartialViewForm wrapping the original form

    Type Parameters
    Name Description
    TPartialModel

    The model type of the partial view

    | Improve this Doc View Source

    Dispose()

    Called when form is created within a using block: writes the end tag of the form.

    Declaration
    public void Dispose()
    | Improve this Doc View Source

    GetFieldGenerator<T>(Expression<Func<TModel, T>>)

    The field generator for the given field.

    Declaration
    public virtual IFieldGenerator GetFieldGenerator<T>(Expression<Func<TModel, T>> property)
    Parameters
    Type Name Description
    System.Linq.Expressions.Expression<System.Func<TModel, T>> property

    The property to return the field generator for

    Returns
    Type Description
    IFieldGenerator
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    Write(IHtmlContent)

    Writes a HTML String directly to the view's output.

    Declaration
    public virtual void Write(IHtmlContent htmlContent)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Html.IHtmlContent htmlContent

    The HTML to write to the view's output

    Implements

    IForm<TModel>
    IForm
    System.IDisposable

    Extension Methods

    HtmlAttributesExtensions.ToHtmlAttributes(Object)
    ChameleonFormExtensions.PartialForAsync<TModel, TPartialModel>(IForm<TModel>, Expression<Func<TModel, TPartialModel>>, String)
    FieldExtensions.FieldElementFor<TModel, T>(IForm<TModel>, Expression<Func<TModel, T>>, IFieldConfiguration)
    FieldExtensions.LabelFor<TModel, T>(IForm<TModel>, Expression<Func<TModel, T>>, IFieldConfiguration)
    FieldExtensions.ValidationMessageFor<TModel, T>(IForm<TModel>, Expression<Func<TModel, T>>, IFieldConfiguration)
    MessageExtensions.BeginMessage<TModel>(IForm<TModel>, MessageType, String)
    MessageExtensions.BeginMessage<TModel>(IForm<TModel>, MessageType, IHtmlContent)
    MessageExtensions.BeginMessage<TModel>(IForm<TModel>, MessageType, Func<Object, IHtmlContent>)
    NavigationExtensions.BeginNavigation<TModel>(IForm<TModel>)
    SectionExtensions.BeginSection<TModel>(IForm<TModel>, String, IHtmlContent, HtmlAttributes)
    SectionExtensions.BeginSection<TModel>(IForm<TModel>, String, Func<Object, IHtmlContent>, HtmlAttributes)
    SectionExtensions.BeginSection<TModel>(IForm<TModel>, IHtmlContent, IHtmlContent, HtmlAttributes)
    SectionExtensions.BeginSection<TModel>(IForm<TModel>, Func<Object, IHtmlContent>, Func<Object, IHtmlContent>, HtmlAttributes)
    • Improve this Doc
    • View Source
    Back to top © Copyright 2012-2020 MRCollective, Rob Moore, Matt Davies and the contributors to ChameleonForms.