Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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]Getting Started
   [Collapse]Data Binding
    [Expand]Large Data Sources: Server and Instant Feedback Modes
     Post Data to an Underlying Data Source
   [Expand]Views
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Sorting
   [Expand]Filter and Search
   [Expand]Summaries
   [Expand]Focus and Selection Handling
    Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
    Split Presentation
    Row Preview Sections
    Scrolling
   [Expand]Batch Modifications
   [Expand]Hit Information
    Hints
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap 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]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

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

How would you rate this topic?​​​​​​​