We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Save changes from sfdatagrid to database using entity framework

Thread ID:

Created:

Updated:

Platform:

Replies:

150912 Jan 24,2020 04:51 AM UTC Jan 27,2020 02:23 PM UTC WinForms 1
loading
Tags: SfDataGrid
Mariusz Juszkiewicz
Asked On January 24, 2020 04:51 AM UTC

I have sfdatagrid bound to entity framework. How do i save or update changes to database with ef.

Saravanan Ayyanar [Syncfusion]
Replied On January 27, 2020 02:23 PM UTC

Hi Mariusz Juszkiewicz, 
 
Thank you for using Syncfusion controls. 
 
You can save the changes and you add the new row by below mentioned events. 
 
Save Data changes  
You can save the data changes by CurrentCellEndEdit event. 
 
C#: 
private void SfDataGrid1_CurrentCellEndEdit(object sender, Syncfusion.WinForms.DataGrid.Events.CurrentCellEndEditEventArgs e) 
 { 
     MessageBox.Show("CurrentCellEndEdit"); 
     //You can add your entity codes here to save the data. 
 } 
 
 
Add New Row 
You can save the add new row changes by RecordsCollectionChanged event. 
 
C#: 
private void Records_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) 
 { 
     if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) 
     { 
         var record = e.NewItems[0] as RecordEntry; 
         //You can add your entity codes here to add the data . 
     } 
 } 
 
 
Sample Link: 
 
You can refer the Entity Framework connection from below UG documentation,  
  
  
For more details refer below links,  
  
  
  
Please let us know, if you need further assistance on this.  
 
Regards, 
Saravanan A. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon