Is there another way of validating the cell when leaving a row?
Note: Leaving a cell in the same row is not a problem.
SOLUTION To achieve data validation prior the row is committed, you can handle the Cell Validating event, which is raised by the control when the current cell changes or when it goes out of edit mode.
However, pressing the Esc key in this situation will revert the initial value of the cell and it will close the editor. The Row Validating event has a slightly different behavior.
When the validation fails, the editor is closed, but the user cannot change the current row in the grid until a valid cell value is entered.
In this situation the editor is not kept active when the validation fails and pressing the Esc key does not revert the changes as the editor is already closed.
This funtionality can be easily implemented by handling the Preview Key Down event, which will revert the row changes after pressing the Esc key.
Let's assume that the If the user enters empty string for a specific cell and tries to navigate to another row, the validation fails and the Error Text is displayed on the corresponding row.
At this point the user is not allowed to cancel the performed changes, pressing the Esc key.
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site.
If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
The Cell Validating event only fires when losing input focus (before leaving the current cell) or when Gc Multi Row validates.