Field validations

You can easily enable validation for the field values by using the attributes provided.
Sitefinity CMS supports the following attributes:
  • EmailAddress
    Validates an email address.
  • MaxLength
    Specifies the maximum length of array or string data that is allowed.
  • MinLength
    Specifies the minimum length of array or string data that is allowed.
  • Range
    Specifies the numeric range limits for the value of a data field.
  • RegularExpression
    Specifies that a data field value in ASP.NET Dynamic Data must match the specified regular expression.
  • Required
    Specifies that a data field value is required.
  • StringLength
    Specifies the minimum and maximum length of characters that are allowed in a data field.
  • Url
    Provides URL validation.

To apply validation attributes, use the following code sample:

These validation attributes are provided in Microsoft's .NET System.ComponentModel.DataAnnotations Namespace.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?

Next article

Conditional fields