Class Section<TModel>
Wraps the output of a form section.
Implements
Inherited Members
Namespace: ChameleonForms.Component
Assembly: ChameleonForms.dll
Syntax
public class Section<TModel> : FormComponent<TModel>, IHtmlContent, ISection, ISection<TModel>, IFormComponent<TModel>, IDisposable
Type Parameters
Name | Description |
---|---|
TModel | The view model type for the current view |
Constructors
| Improve this Doc View SourceSection(IForm<TModel>, IHtmlContent, Boolean, IHtmlContent, HtmlAttributes)
Creates a form section
Declaration
public Section(IForm<TModel> form, IHtmlContent heading, bool nested, IHtmlContent leadingHtml = null, HtmlAttributes htmlAttributes = null)
Parameters
Type | Name | Description |
---|---|---|
IForm<TModel> | form | The form the message is being created in |
Microsoft.AspNetCore.Html.IHtmlContent | heading | The heading for the section |
System.Boolean | nested | Whether the section is nested within another section |
Microsoft.AspNetCore.Html.IHtmlContent | leadingHtml | Any HTML to output at the start of the section |
HtmlAttributes | htmlAttributes | Any HTML attributes to apply to the section container |
Methods
| Improve this Doc View SourceBegin()
Returns the HTML representation of the beginning of the form component.
Declaration
public override IHtmlContent Begin()
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The beginning HTML for the form component |
Overrides
CreatePartialSection(IHtmlHelper<TModel>)
Returns a section with the same characteristics as the current section, but using the given partial form.
Declaration
public ISection<TModel> CreatePartialSection(IHtmlHelper<TModel> partialHelper)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> | partialHelper | The HTML helper from the partial view |
Returns
Type | Description |
---|---|
ISection<TModel> | A section with the same characteristics as the current section, but using the given partial form |
CreatePartialSection<TPartialModel>(IForm<TPartialModel>)
Returns a section with the same characteristics as the current section, but using the given partial form.
Declaration
public ISection<TPartialModel> CreatePartialSection<TPartialModel>(IForm<TPartialModel> partialModelForm)
Parameters
Type | Name | Description |
---|---|---|
IForm<TPartialModel> | partialModelForm | The Form<TModel> from the partial view |
Returns
Type | Description |
---|---|
ISection<TPartialModel> | A section with the same characteristics as the current section, but using the given partial form |
Type Parameters
Name | Description |
---|---|
TPartialModel | The model type of the partial view |
Dispose()
Called when form section is created within a using
block: writes the end tag(s) of the section.
Declaration
public override void Dispose()
Overrides
End()
Returns the HTML representation of the end of the form component.
Declaration
public override IHtmlContent End()
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Html.IHtmlContent | The ending HTML for the form component |
Overrides
Field(IHtmlContent, IHtmlContent, IHtmlContent, ModelMetadata, Boolean, IFieldConfiguration)
Outputs a field with passed in HTML.
Declaration
public IFieldConfiguration Field(IHtmlContent labelHtml, IHtmlContent elementHtml, IHtmlContent validationHtml = null, ModelMetadata metadata = null, bool isValid = true, IFieldConfiguration fieldConfiguration = null)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Html.IHtmlContent | labelHtml | The HTML for the label part of the field |
Microsoft.AspNetCore.Html.IHtmlContent | elementHtml | The HTML for the field element part of the field |
Microsoft.AspNetCore.Html.IHtmlContent | validationHtml | The HTML for the validation markup part of the field |
Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata | metadata | Any field metadata |
System.Boolean | isValid | Whether or not the field is valid |
IFieldConfiguration | fieldConfiguration | Optional field configuration |
Returns
Type | Description |
---|---|
IFieldConfiguration | A field configuration that can be used to output the field as well as configure it fluently |