I have a textbox and a grid displaying 10 lines of item.
First, I modified data in grid.
Then while editing the second line of data, I found clicking out of the grid will not set the focus out from the grid.
Why and How can I set the grid out from edit mode when I click out of the grid?
Please advice, Thanks.
Hi I tried your suggestion but seem to have a problem.
I am using the BeforeExitEditMode to validate a cell in the grid, and to keep the focus in the cell if the validation failed.
This works fine since I have "e.Cancel = true" in the method (for validation failing).
Below the grid, I have a "Cancel" button.
If the user gives up (because they do not know a valid input value), they should be able to click the cancel button.
However, after I added your code fpr LoseFocus, the BeforeExitEditMode method is being called.
(There is also another problem...
When I added your code, and then click in a cell when the form displays, the LoseFocus method is being invoked.
Any ideas as to the causes of these two issues would be appreciated).
Thanks.
The grid will automatically write any pending changes to the underlying data source when it loses focus. So you don't really have to do anything in that case.
If you want to force the grid to update in a case where the grid is not losing focus, then you can use the grid.UpdateData() method. You may need to also call grid.PerformAction(ExitEditMode) before the call to UpdateData in order to take the current cell out of edit mode, if there is one.
Thanks Hady!
So, we need to use UltraGrid LostFocus event for those control that has focus properties; else had to trigger the UltraGrid LostFocus event specifically at those control's MouseClick event.
that's because groupbox doesn't get focus.. labels do not get focus 2.
in such cases you should add event mouse click to the control
Hi Hady,
I found that it is not works for GroupBox control. Clicking on control in the groupbox will not trigger lost focus event?
See my sample.
Thanks!!!