Razor Validation Helpers
- Methods on the
Validation property of the WebPage base class applied to all Razor pages:
.RequireField(string field, string errorMessage).Add(string field, params IValidator[] validators) and .Add(IEnumerable<string> fields, params IValidator[] validators)
- Static methods on the
Validator factory class for creating different kinds of validators
.StringLength(int maxLength, int minLength=0, string errorMessage = null).Range(double minValue, double maxValue, string errorMessage = null)`.Decimal(string errorMessage = null).Integer(string errorMessage = null).Url(string errorMessage = null).DateTime(string errorMessage = null)
@Html.ValidationSummary() and @Html.ValidationMessage()
Showing Images