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 ASP.NET System.ComponentModel.DataAnnotations Namespace.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?

Next article

Conditional fields