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

Add new row

Dear Sir, I have a GridDataBoundGrid on a form, and I set the EnableAddNew = false and I use a button to add rows with the following code: this.grid.Binder.EnableAddNew = true; this.grid.Binder.AddNew(); this.grid.Binder.EnableAddNew = false; this.grid.Refresh(); But I have a problem: I add a row and I make some changes in this row. If I add a new row with the same mechanism the changes in the anterior row are lost and the row is initialized with the default values. I want all changes I make to remain when I add a row.Thank you

1 Reply

AD Administrator Syncfusion Team March 29, 2004 07:30 AM UTC

Before doing the code to add the new row, call this.grid.Binder.EndEdit() to tell the grid to save any open changes. You also may want to first call this.grid.CurrentCell.EndEdit() if you are alolowing teh user to type into the grid to add the new values. Or, you can just add the row directly to the DataSource and not use the grid at all.

Live Chat Icon For mobile
Up arrow icon