Change Theme Settings
Change Theme Settings
Themes
 
Show All Themes
v
...v

Binding to a Single Object

Personal Information
*
*
v
*
Location
v
Submit

This demo illustrates how to use the ASPxFormLayout control to edit fields of a data source and validate input values using Data Annotation attributes.

In this demo, the edited data is specified via the ASPxFormLayout.DataSource property value in the code-behind. Validation rules are specified in the model class via Data Annotation attributes. Currently, ASPxFormLayout supports the following Data annotation attributes:

  • BrowsableAttribute
  • RequiredAttribute
  • RegularExpressionAttribute
  • RangeAttribute
  • DisplayFormatAttribute
  • DisplayAttribute
  • DataTypeAttribute

ASPxFormLayout layout items are gathered in the Items collection and are bound to data source fields using the LayoutItem.FieldName property. Each layout item contains a DevExpress data editor that allows editing values of the corresponding field type.

When the edit form is submitted to the server, new field values are obtained via the GetNestedControlValueByFieldName method in the code-behind.