[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]ASP.NET WebForms Controls
 [Collapse]ASP.NET MVC Extensions
  [Expand]Product Information
  [Expand]Getting Started
  [Expand]Common Concepts
  [Expand]Grid View
  [Expand]Tree List
  [Expand]Card View
   Reporting
  [Expand]Charting
  [Expand]Pivot Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Scheduler
  [Expand]Site Navigation and Layout
  [Expand]HTML Editor
  [Expand]Vertical Grid
  [Collapse]Data Editors Extensions
    Editor List
    Main Features
   [Collapse]Common Concepts
    [Collapse]Binding Data Editors to Data
      Binding to Large Data (Database Server Mode)
     Getting Editor Values
     Mask Editing
    [Expand]Validation
     Accessibility Support
   [Expand]BinaryImage
   [Expand]Button
   [Expand]ButtonEdit
   [Expand]Calendar
   [Expand]Captcha
   [Expand]CheckBox
   [Expand]CheckBoxList
   [Expand]ColorEdit
   [Expand]ComboBox
   [Expand]DateEdit
   [Expand]DropDownEdit
    Filter Control
   [Expand]GridLookup
   [Expand]HyperLink
   [Expand]Image
   [Expand]Label
   [Expand]ListBox
   [Expand]Memo
   [Expand]ProgressBar
   [Expand]RadioButton
   [Expand]RadioButtonList
   [Expand]SpinEdit
   [Expand]TextBox
   [Expand]TimeEdit
   [Expand]TokenBox
   [Expand]TrackBar
   [Expand]ValidationSummary
   [Expand]Strongly-Typed Editor Types
  [Expand]Docking and Popups
  [Expand]File Management
  [Expand]Data and Image Navigation
  [Expand]Multi-Use Site Extensions
  [Expand]SpellChecker
  [Expand]Query Builder
 [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]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Binding Data Editors to Data

To bind a DevExpress editor to a value, use the editor's EditorExtension.Bind method. It has two overloads, allowing you to bind an editor either directly to its value or to a specific property of a data object (Model).

Note, that you can use strongly typed data editors that can be bound to a model's property using a lambda expression.

Expanded Binding to Model

When DevExpress editors are bound to data model fields (by using Bind(dataObject, propertyName) methods or using strongly typed helpers), the DevExpressEditorsBinder model binder must be used instead of the default model binder to correctly transfer values from DevExpress editors back to corresponding data model fields.

You can specify DevExpressEditorsBinder as a model binder in the following manners.

  • Decorating the Parameter of Action Method

    You can declare DevExpressEditorsBinder as a parameter attribute on an action method: ([ModelBinder(typeof(DevExpressEditorsBinder))])

    Controller:

  • Overriding the Default Model Binder

    You can assign DevExpressEditorsBinder to the ModelBinders.Binders.DefaultBinder property to replace the global default model binder.

    Global.asax:

Note

Starting with v2012 vol 1, DevExpressEditorsBinder is automatically defined as a default model binder within projects created with the help of DevExpress MVC project templates.

Expanded List Editors Binding

List editors additionally implement the BindList method. It allows you to provide list editors with item list data.

The table below contains links to list editor related BindList methods.

Editor Method
CheckBoxList CheckBoxListExtension.BindList
ComboBox ComboBoxExtension.BindList
GridLookup GridLookupExtension.BindList
ListBox ListBoxExtension.BindList
RadioButtonList RadioButtonListExtension.BindList
TokenBox TokenBoxExtension.BindList
TrackBar TrackBarExtension.BindList

Expanded Example

The code below demonstrates how the Bind and BindList methods can be used to bind the TextBox and ComboBox (see GridView - External Edit Form online demo for more code).

View Code - "EditingForm" (ASPX):

View Code - "EditingForm" (Razor):

Expanded See Also

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