[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Get Started With Data Grid and Views
   [Collapse]Data Binding
    [Expand]Large Data Sources: Server and Instant Feedback Modes
     Post Data to an Underlying Data Source
    Unbound Columns
   [Expand]Data Editing and Validation
   [Expand]Filter and Search
   [Expand]Focus and Selection Handling
    Format Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
    Split Presentation
    Row Preview Sections
   [Expand]Batch Modifications
    Hit Information
    Popup Menus
   [Expand]Save and Restore Layout
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[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]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Post Data to an Underlying Data Source

Expanded Common Tips

Regardless of the data binding method, changes to an underlying source should typically be posted on the following events.

Expanded ADO.NET Data with a DataAdapter and DataSet

In traditional ADO.NET data binding, your Data Grid is bound to a Data Set, populated from an underlying data source by a Data Adapter. In this case, to post changes back to an underlying data source, call the Adapter's Update method.

Note that to save changes, an Adapter must generate INSERT, UPDATE and DELETE commands.

Expanded Entity Framework

When binding to the Entity Framework and Entity Framework Core models, the Data Grid is bound to a DbContext (see System.Data.Entity.DbContext) object. Call the SaveChanges or SaveChangesAsync methods to post changes to an underlying data source.

Expanded Entity Framework Core

EF Core utilizes a different class of a DbContext than the one used for regular Entity Framework.

Expanded Linq to SQL

In Linq to SQL binding, a Data Grid's data source is an object of the DataContext class. Utilize its SubmitChanges method to save changes.

Expanded eXpress Persistent Objects (XPO)

To post changes to a data source, call the UnitOfWork.CommitChanges method. When working with sessions, the saving of persistent objects posts changes to the data source automatically.

Expanded OData

Binding to Open Data sources requires a Microsoft.OData.Client.DataServiceQuery table stored within a Microsoft.OData.Client.DataServiceContext object. To save Data Grid edits, you need to utilize the DataServiceContext API: methods like DeleteObject or UpdateObject. These methods will send corresponding HTTP queries after you call the DataServiceContext.SaveChanges method.The code for these HTTP queries must be added to a back-end application.

Note that implementing in-place editing when the Data Grid is bound to a server-side data source, including Open Data sources, is not recommended. A preferable approach for this scenario is to make a substitute Data Grid source (e.g., a BindingList object populated from an OData source).

Expanded See Also

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