aspnet-400998-components-site-navigation-and-layout-form-layout-concepts-data-annotation-attributes.md
DevExpress ASP.NET ASPxFormLayout control supports data annotation attributes. You can apply these attributes to the class to specify validation rules and data display mode, set relationships between classes, etc.
class TestClass {
[Display(Name = "Check it")]
[CheckBoxRequired(ErrorMessage = "Error text")]
public bool CheckBoxField { get; set; }
}
<dx:ASPxFormLayout runat="server" ID="fl">
<Items>
<dx:LayoutItem FieldName="CheckBoxField">
<LayoutItemNestedControlCollection>
<dx:LayoutItemNestedControlContainer>
<dx:ASPxCheckBox runat="server" />
</dx:LayoutItemNestedControlContainer>
</LayoutItemNestedControlCollection>
</dx:LayoutItem>
...
</Items>
</dx:ASPxFormLayout>
Common data attributes supported by DevExpress data controls are as follows.
CheckBoxValuesAttribute - Specifies the check box value.
DisplayFormatAttribute - Specifies a data field’s display format.
MaxLengthAttribute - Specifies a property value’s maximum length.
RegularExpressionAttribute - Specifies that a data field value should match the specified regular expression.
DataType.Currency and DataType.Password types.CheckBoxRequiredAttribute - Specifies that a check box is required.
RangeAttribute - Specifies numeric range constraints for the data field value.
RequiredAttribute - Specifies that a data field value is required.