Greetings,
I am developing a VB .NET form that includes an Ultra Grid that contains child information. For one of the columns on the grid, I am using a value list set up as a dropdown list so users can only enter what is in the list. One thing I noticed in testing is once an item is selected in the drop down, the cell does not lose focus. The problem this causes is if the user hits save, the grid does not recognize the selected value and it is not saved to the database. The work around is to manually tab off the cell so the value is now is now recognized by the grid.
Is there a way to force a move off the cell once a value is selected from the drop down list so the data it contains is recognized by the grid and can be properly saved?
Thanks
What you have to do before saving is to notify the grid that it needs to accept the current edits that the user had made. The problem you are having is that the row the user is editing is still in edit mode and the changes haven't been submitted back to the data source. I'm assuming you have the grid's update mode set to OnCellChangeOrLostFocus so it submits updates after each cell is changed so moving to focus is an artificial way of getting your updates submitted.
If I'm not mistaken you can call the EndUpdate method against the grid or probably better would be to call EndEdit on your binding source assuming you are using one for the grid.
Hi Steve,
Thanks for the advice. I've tried to use end edit on the binding source to control this, but it didn;t work. I'll give your other suggestion a try to see if they do what I need it to.
Thanks Mike. You described the scenario I was encountering. The every time an option on the tool bar was used such as previous record the user is never prompted to save the existing record. Calling UpdateData solved this problem.
Thanks again.
Darn. That was the method I was trying to thinking of.
The grid will update automatically if it loses focus, but some buttons do not take focus. Toolbar buttons, for example, do not take focus away from the grid.
What you need to do is call UpdateData on the grid before you attempt to save.
Do you have your Grid update mode set to OnCellChangeOrLostFocus? If the user moves off the grid to click a save button it should accept the current row edit.