Updating the Datasource

When I change a cell value in the grid and hit tab the changes are not saved to the data source immediately.  As long as I am on the same row that I changed a cell value then the changes are not reflected in my SQL table.  With the GridDataBoundGrid I used the following commands to update the data source:

Me.GridDataBoundBrid.Binder.EndEdit()
Me.TableAdapter.Update(Dataset)

What are the equivalent command(s) to allow the sfDataGrid to save a row to the data source immediately after a single cell has changed?

Thanks

1 Reply

MA Mohanram Anbukkarasu Syncfusion Team July 27, 2018 12:40 PM UTC

Hi Derek, 
 
Thanks for contacting Syncfusion support. 
 
By default, when the cell leaves from editing it will automatically update the view of grid alone to refresh the changes. It will affect only the view properties of the grid and will not update the changes to the underlying source file.  
 
The below example shows the data source update for .MDB file using the BindingSource & TableAdapter. Like the following example, you could update your underlying data source file manually.    
 
To update the changes of the Data Source (grid level changes) to the underlying source file when the cell leaves from editing, you can end editing of the binding source and update the TableAdapter in the CurrentCellEndEdit event.      
     
Code Sample:     
void sfDataGrid_CurrentCellEndEdit(object sender, Syncfusion.WinForms.DataGrid.Events.CurrentCellEndEditEventArgs e) 
{    
    this.table1BindingSource.EndEdit();    
    this.table1TableAdapter.Update(this.customSourceDataSet.Table1);                
}    
    
Regards, 
Mohanram A. 


Loader.
Up arrow icon