Class ValidationHelper
Augments tags with bootstrap validation classes and messages if validation failed for the model field
identified by the expression in the attribute bs-validation-for
.
For controls (input, textarea and select tags), the form-control
and form-control-danger
classes are added.
If the tag has a form-group
class set, the has-danger
class is added. Otherwise, the
form-control-feedback
class is added and the tag content is set to the corresponding validation error
message.
Inheritance
Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
ValidationHelper
Namespace: XploRe.AspNetCore.Mvc.TagHelpers.Bootstrap4
Assembly: XploRe.AspNetCore.Mvc.TagHelpers.Bootstrap4.dll
Syntax
public class ValidationHelper : TagHelper
Constructors
Name | Description |
---|---|
ValidationHelper(IHtmlGenerator) | Initialises a new ValidationHelper instance. |
Properties
Name | Description |
---|---|
For | Name to be validated on the current model. If not specified, no action is performed. |
Generator | The cached Microsoft.AspNetCore.Mvc.ViewFeatures.IHtmlGenerator service instance. |
ViewContext | The automatically assigned ViewContext instance. |
Methods
Name | Description |
---|---|
ProcessAsync(TagHelperContext, TagHelperOutput) |