[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
   Getting Started
  [Expand]Grid View
  [Expand]Tree List
  [Expand]Card View
  [Expand]Chart Control
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
  [Collapse]Site Navigation and Layout
   [Expand]Product Information
   [Collapse]Form Layout
     ASPxFormLayout Overview
     [Collapse]Binding to Data
       Binding to Data Overview
       Binding to a Data Source
       Binding to a Single Object
      Item Manipulation
    [Expand]Visual Elements
   [Expand]Navigation Bar
   [Expand]Page Control and Tab Control
    Panel Overview
   [Expand]Site Map Control
   [Expand]Tag Cloud Control
   [Expand]Title Index
  [Expand]HTML Editor
  [Expand]Vertical Grid
  [Expand]Data Editors
  [Expand]Docking and Popups
  [Expand]File Management
  [Expand]Data and Image Navigation
  [Expand]Multi-Use Site Controls
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Binding to a Data Source

Expanded Binding to a Data Source at Design Time

The FormLayout control can be used to edit or display data retrieved from a database via a data source control.

To bind a FormLayout to a data source control, click the smart tag of the FormLayout. In the invoked actions list, select an existing data source (if any), or create a new data source, from the Choose Data Source drop-down list.

The FormLayout control will automatically generate layout items for data source fields. The LayoutItem.FieldName property value of each layout generated is set to a corresponding data source field name.

The table below illustrates which DevExpress Data Editors are automatically nested into the FormLayout for different field value types. Nullable types are also supported.

Value TypeAutomatically Nested Data Editor
String, CharTextBox
Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Single, Double, DecimalSpinEdit

You can add/delete/edit any layout item according to your needs (e.g., you can group layout items, add unbound layout items, customize automatically nested controls)

Expanded Binding to a Data Source at Runtime

To bind a FormLayout to a data source in code, define the data source via the DataSource or DataSourceID property, as shown in the code sample below.

The FormLayout control will automatically generate layout items for all data source fields with the default design and layout at runtime.

The image below shows the look and feel of a FormLayout with layout items that are automatically generated at runtime.

Expanded See Also

Is this topic helpful?​​​​​​​