Skip to content

ValidateLengthAttribute class

namespace: Serenity.ComponentModel   assembly: Serenity.Net.Core

Requires a text to have no more than a number of characters, and no fewer than MinimumLength when it is set, which the forms also check. An empty value is valid, as being required is RequiredAttribute's concern.

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
public class ValidateLengthAttribute : StringLengthAttribute, IClientValidationRule, IHasTextKey
parameter description
maximumLength The most characters the text can have.

Public Members

name description
ValidateLengthAttribute(…) Requires a text to have no more than a number of characters, and no fewer than MinimumLength when it is set, which the forms also check. An empty value is valid, as being required is RequiredAttribute's concern.
Rule { get; }
RuleParams { get; } Gets the minimum and the maximum length, where a minimum of zero is none.
Side { get; set; }
TextKey { get; set; }
const Key The type key of the class of the rule on the client side, i.e. Serenity.LengthValidationRule.

Protected Members

name description
override IsValid(…)

See Also