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. Image for the cookie policy date

Cannot save new row to database via Entity Framework

I am using VS 2013 .Net Framework 4.5.1 and a recent update to Syncfusion.

I am using the SfDataGrid with AddNewRowPosition and a Save button.  My configuration, which is as simple as I can make it, allows me to edit and save existing rows in the Northwind Category table.  
Although I can add rows to the grid, the new rows are not being saved.

Attachment: WpfApplication15_a0a3b110.zip

1 Reply

JS Jayapradha S Syncfusion Team April 5, 2016 02:54 AM UTC

Hi John,

Thank you for contacting Syncfusion Support.

You can add  a new record in AddNewRow and you can update the database using  RowValidatingEvent like below,

this.SfDataGrid1.RowValidating += SfDataGrid1_RowValidating;

void SfDataGrid1_RowValidating(object sender, Syncfusion.UI.Xaml.Grid.RowValidatingEventArgs args)


            Category newRecord = args.RowData as Category;

            Category category = new Category();

            category.Description = newRecord.Description;

            using(Entities entity=new Entities())





Please refer the below reference links to add a new record using DBContext,

Reference Links: http://www.entityframeworktutorial.net/EntityFramework4.3/add-entity-using-dbcontext.aspx
We are unable to run your attached sample. Since in that attachment, db is missing. If you are facing any problem with above code snippet, then you please share your sample with db.


Live Chat Icon For mobile
Up arrow icon