After Adding New Row, force it to commit
I am using the Syncfusion DataGrid. It has an empty row at the top to Add New Records. If I add a new record and then click on another row, it WILL save it. If I click away from the grid after adding a new record, it will not save.
I need the code that will force the datagrid to commit that new row that was created without forcing my users to click on another row or even expecting them to hit enter.
I want to programmtically force the grid to save the new row.
Thanks!
I need the code that will force the datagrid to commit that new row that was created without forcing my users to click on another row or even expecting them to hit enter.
I want to programmtically force the grid to save the new row.
Thanks!
SIGN IN To post a reply.
3 Replies
RG
Rajasekar G
Syncfusion Team
May 14, 2013 10:20 AM UTC
Hi Paul,
Thanks for
the patience.
We have
analyzed your query and we have achieve your requirement by using the following
code snippet.
Code
Snippet[C#]:
this.AssociatedObject.CurrentCellChanged += new Syncfusion.Windows.ComponentModel.GridRoutedEventHandler(AssociatedObject_CurrentCellChanged); void AssociatedObject_CurrentCellChanged(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs args) {int rowindex = this.AssociatedObject.Model.CurrencyManager.CurrentCell.RowIndex; int columnindex = this.AssociatedObject.Model.CurrencyManager.CurrentCell.ColumnIndex; var style = this.AssociatedObject.Model[rowindex, columnindex] as GridDataStyleInfo; if (style.CellIdentity.TableCellType == GridDataTableCellType.AddNewRecordCell && columnindex == this.AssociatedObject.Model.ColumnCount - 1) {//you can commit the added new record by using the following code snippet if (this.AssociatedObject.Model.CurrencyManager != null) this.AssociatedObject.Model.CurrencyManager.EndEdit(); } }
|
For your
reference we have prepared a sample based on this and it can be download from
the following location.
Sample
Location: GridDataControl_AddNewRow.zip
Please let
us know if you have any questions.
Regards.,
Rajasekar
AR
Arlvin
February 23, 2021 05:23 PM UTC
This does not seem to work with the current version of the controls. Could you provide an updated solution.
BT
Balamurugan Thirumalaikumar
Syncfusion Team
February 24, 2021 12:21 PM UTC
Hi Arlvin,
Thank you for using Syncfusion products.
We have check the previous updates of this thread which used GridDataControl. Can you please get back us with which control currently you are using and exact query of yours. so that, we could analyse further to provide you a better solution at the earliest.
Please let us know if you would require any other assistance.
Regards,
Balamurugan Thirumalaikumar
SIGN IN To post a reply.
- 3 Replies
- 4 Participants
-
PM Paul McCranie
- Mar 21, 2013 09:51 PM UTC
- Feb 24, 2021 12:21 PM UTC