Save the data from the gridGroupingControl to the database using the Entity framework

Hello
Help me figure it out.
How to save data from gridGroupingControl to the database when editing a cell. The TableControlCurrentCellEditingComplete event is suitable for this, as far as I understand. I use the Entyti framework to communicate with gridGroupingControl.

3 Replies

AR Arulpriya Ramalingam Syncfusion Team February 8, 2018 09:57 AM UTC

Hi Aleksew,  
  
Thanks for contacting Syncfusion support.  
  
By default, the modified changes will be updated in the underlying data source whenever the current record is changed or control lost its focus. To update the changes immediately whenever the editing completed, the modified values can be retrieved and updated the source manually by using the SaveChanges() method of CurrentRecordProperty. We created a simple sample as per your requirement and make use of the below code and sample,  
  
Code example  
  
//Event triggering  
gridGroupingControl1.TableControlCurrentCellEditingComplete += GridGroupingControl1_TableControlCurrentCellEditingComplete;  
  
//Event customization  
private void GridGroupingControl1_TableControlCurrentCellEditingComplete(objectsender, GridTableControlEventArgs e)  
{  
    EndEdit(e.TableControl.Table as GridTable);  
}  
  
public void EndEdit(GridTable table)  
{  
    CurrentRecordPropertyCollection collection = table.CurrentRecordManager.Properties;  
    ArrayList modifiedProperties = new ArrayList();  
    foreach (CurrentRecordProperty prop in collection)  
    {  
        if (prop.IsModified)  
        {  
            //To add the property descriptor to modified property descriptor  
            modifiedProperties.Add(prop);  
        }  
    }  
  
    foreach (CurrentRecordProperty prop in modifiedProperties)  
    {  
        //Update the changes to the underlying data source  
        prop.SaveChanges();  
    }  
}  
  
  
Regards,  
Arulpriya  



AL Aleksew February 12, 2018 09:31 PM UTC

Thank you very much for your help)). This is what was needed!!


AR Arulpriya Ramalingam Syncfusion Team February 13, 2018 04:58 AM UTC

Hi Aleksew, 
 
Thanks for your update. 
 
We are glad to hear that the provided solution resolved your requirement. 
 
Please let us know, if you have any other queries. 
 
Regards, 
Arulpriya 


Loader.
Up arrow icon