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

GridGroupingControl & TableControlCurrentCellValidated

Hi, I want to save the current record when i move to another cell (not only when i move to another row). To do this, i use the TableControlCurrentCellValidated event and EndEdit function : private void Grid_TableControlCurrentCellValidated(object sender, GridTableControlEventArgs e) { if (this.ggc_grid.Table.CurrentRecord != null) this.ggc_grid.Table.CurrentRecord.EndEdit(); } When i try it an exception occurs : System.InvalidOperationException: AddNew not called at Syncfusion.Grouping.AddNewRecord.SetValue(FieldDescriptor fieldDescriptor, Object value) at Syncfusion.Windows.Forms.Grid.Grouping.GridAddNewRecord.Syncfusion.Windows.Forms.Grid.Grouping.IGridTableCellStyleChanged.RaiseTableCellStyleChanged(GridTableCellStyleInfoEventArgs e) at Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoIdentity.OnStyleChanged(StyleInfoBase style, StyleInfoProperty sip) at Syncfusion.Styles.StyleInfoBase.OnStyleChanged(StyleInfoProperty sip) at Syncfusion.Windows.Forms.Grid.GridStyleInfo.OnStyleChanged(StyleInfoProperty sip) at Syncfusion.Styles.StyleInfoBase.SetValue(StyleInfoProperty sip, Object value) at Syncfusion.Windows.Forms.Grid.GridStyleInfo.set_CellValue(Object value) at SageCoala.Cool.Compta.JournalForm.Grid_SaveCellFormattedText(Object sender, GridCellTextEventArgs e) in c:\my projects 2\sagecoala.cool\dllcool\compta\journalform.cs:line 527 at Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl.OnSaveCellFormattedText(GridCellTextEventArgs e) at Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl.RaiseSaveCellFormattedText(GridCellTextEventArgs e) at Syncfusion.Windows.Forms.Grid.Grouping.GridEngine.OnSaveCellFormattedText(GridCellTextEventArgs e) at Syncfusion.Windows.Forms.Grid.Grouping.GridEngine.RaiseSaveCellFormattedText(GridCellTextEventArgs e) at Syncfusion.Windows.Forms.Grid.Grouping.GridTableModel.OnSaveCellFormattedText(GridCellTextEventArgs e) at Syncfusion.Windows.Forms.Grid.GridModel.RaiseSaveCellFormattedText(GridCellTextEventArgs e) at Syncfusion.Windows.Forms.Grid.GridCellModelBase.ApplyFormattedText(GridStyleInfo style, String text, Int32 textInfo) at Syncfusion.Windows.Forms.Grid.GridStyleInfo.ApplyFormattedText(String text) at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.OnSaveChanges() at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.RaiseSaveChanges() at Syncfusion.Windows.Forms.Grid.GridCurrentCell.ConfirmChanges(Boolean closeDropDown) catched at Syncfusion.Windows.Forms.Grid.GridCurrentCell.ConfirmChanges(Boolean closeDropDown) in :line 0 What is the problem, and how can i fix it ? Is there another solution to have this behavior ? Regards, Mikaël

3 Replies

AD Administrator Syncfusion Team July 11, 2005 09:14 AM UTC

Try using the RecordValueChanged event, calling e.Record.EndEdit() in your handler, to see if that will avoid this problem.


MM Mikaël Morvan July 11, 2005 10:03 AM UTC

Ok, it avoid the problem. Now when i use the append row and i validate a cell, the row was save and a new append row appears, and the current cell move to the new append row. How can i prevent the current cell move to the new append row ?


AD Administrator Syncfusion Team July 11, 2005 10:23 AM UTC

If you end the edit early on the addnew row, there is no way to avoid the grid putting the newly added row in its proper position. You cannot avoid doing this if you call record.EndEdit to save the changes wherever you leave a cell. If you do not want this to happen, you would have to avoid calling EndEdit for the AddNew row. if(!(e.Record is GridAddNewRecord)) e.Record.EndEdit();

Loader.
Live Chat Icon For mobile
Up arrow icon