Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
   Getting Started
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Collapse]Site Navigation and Layout
   [Expand]Product Information
   [Collapse]Form Layout
     ASPxFormLayout Overview
    [Collapse]Concepts
     [Collapse]Binding to Data
       Binding to Data Overview
       Binding to a Data Source
       Binding to a Single Object
      Item Manipulation
      Adaptivity
    [Expand]Visual Elements
   [Expand]Menu
   [Expand]Navigation Bar
   [Expand]Page Control and Tab Control
    Panel Overview
   [Expand]Ribbon
   [Expand]Site Map Control
   [Expand]Splitter
   [Expand]Tag Cloud Control
   [Expand]Title Index
   [Expand]TreeView
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[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
byte[]BinaryImage
String, CharTextBox
Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Single, Double, DecimalSpinEdit
EnumComboBox
BooleanCheckBox
DateTimeDateEdit

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?​​​​​​​