Show theme settings Shopping cart Download trialFree Trial
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.

Collapse/Expand
Local Copy of this Demo
To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer.
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
Open CS Solution
Open VB Solution
The source code files for this demo are installed (by default) in the following directories:
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\ASPxNavigationAndLayoutDemos
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\VB\ASPxNavigationAndLayoutDemos