Hi,
I am testing out an ultragrid on a winform. The ultragrid is bound to a datatable using dataset/tableadapter (wizard).
When I click the BindingNavigators save button my added row is only saved if I first move the cursor from the new row onto another row in the grid.
How can I change this setting/behavior?
The bindingsource.endedit method is called when the BindingNavigator save button is clicked, but it does not appear to have an effect if the cursor still is in the new grid row.
Thanks,
Kai
Hi Kai,
The grid commits the changes to the underlying data source based on the UpdateMode property. By default, it happens when the grid loses focus or changes rows. You can change this property to also include changing cells.
But I expect that your navigator doesn't take focus and therefore the grid is not losing focus and so the current cell in edit mode doesn't get committed. So what you probably need to do is something like this:
grid.PerformAction(ExitEditMode);
grid.Update();
Thanks Mike,
At first your suggestion seemed to do the trick, but after some testing the improvement appeared incosistent.
I however tried:PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.CommitRow) which seems to help completely.
Is there any obvious untowards effects of "commitrow" that I should expect?
Regards,
UltraGridRow aRow = grdForm.Rows[i]; if (aRow.IsUnmodifiedTemplateAddRow) { aRow.Update(); }