Table of Contents

Class ValidationRule<TValue>

Namespace
Kentico.Forms.Web.Mvc
Assembly
Kentico.Content.Web.Mvc.dll

Represents a base class for a form component validation rule. Inherit this class to create custom validation rules.

public abstract class ValidationRule<TValue> : ValidationRule

Type Parameters

TValue

Type of value which is supposed to be validated by this rule

Inheritance
object
ValidationRule<TValue>
Derived
Inherited Members
Extension Methods

Methods

IsValueValid(object)

Validates the form component's value and returns true if the value is valid. This method is used by system.

public override sealed bool IsValueValid(object value)

Parameters

value object

Value of the form component.

Returns

bool

true if the value is valid, otherwise false.

Validate(TValue)

Wrapped by IsValueValid(object) which converts the value to type specified by the generic type. Override this method to apply desired validation.

protected abstract bool Validate(TValue value)

Parameters

value TValue

Value of the form component.

Returns

bool

true if the value is valid, otherwise false.

See Also