Hi Trent,
No problem about the delay - that is still fast based on my previous framework standards!
I have attached a one BO and one form project that works with your Products table. The UltraGrid is 2008 vol 2. I have made all visible fields a "required field". To see the problem do this:-
1. Run the form.
2. Click Edit and click on the first record.
3. Click or tab into the empty product description column and type something in. Please note that you should NOT leave the cell. With the cursor still in the description cell containing your new text, click on the Save button. You will be told you have a broken rule which is the framework believing the description cell is empty when that is incorrect.
The basic problem is the grid is still in edit mode. I have tried using the BO events to intercept the save and make the grid exit edit mode. However, it looks like the framework caches the field value at a very early stage and doesn't see that the field is updated when the grid changes mode during the BO events.
I have come up with a workaround by adding the following handler to the toolbar click event:-
private void MaintenanceFormToolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
// The grid must exit edit mode to ensure the current cell is handled properly for a save or undo
if (e.ClickedItem.ToString() == "Save" || e.ClickedItem.ToString() == "Undo")
Grid.PerformAction(UltraGridAction.ExitEditMode);
}
I haven't fully tested this and it is possible I still have to deactivate the current cell before issuing the Grid.PerformAction. It also will not work when the user closes the form and is asked to save.
While the above can be made to work, I think it would be better if the framework didn't cache the field so soon to allow a more graceful solution during the BO save events. While it is possible to exit edit more on the grid in the BeforeSave or CheckRulesOnCurrentRow events and the BO field property is correctly updated, it is too late for the required fields check. Even though the check is still to occur, the blank value has been already cached and this is used instead of the current field value in the BO at the point the check is run.
Thanks
Aaron