AllowEmptyStrings Property
Collapse the table of content
Expand the table of content

RequiredAttribute.AllowEmptyStrings Property

Gets or sets a value that indicates whether an empty string is allowed.

Namespace:  System.ComponentModel.DataAnnotations
Assembly:  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)

public bool AllowEmptyStrings { get; set; }

Property Value

Type: System.Boolean
true if an empty string is allowed; otherwise, false. The default value is false.

When you set AllowEmptyStrings to true for a data field, Dynamic Data does not perform validation and transforms the empty string to a null value. This value is then passed to the database.

If the database does not allow null values, it raises an error. To avoid this error, you must also set the ConvertEmptyStringToNull to false.

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2016 Microsoft