I have a grid in which certain columns/cells have a MaskInput and Format. For example:
column.Format = "dd/MM/yyyy";column.MaskInput = "dd/mm/yyyy";
This all works fine as long as the entered data can be converted to the column DataType (in this case obviously DateTime). But if the user accidently enters __/__/2008 the conversion fails and a popup is shown with following error message:
Unable to update the data value: Value in the editor is not valid.
Is it possible to supress the error dialogbox? I don't want it to show. I would prefer the grid discards the invalid entered info (and reverts to the old value) or enters a default value.
- Infragistics .NET Advantage for Windows Forms 2008 Volume 2
Thanks!
Hi Marc,
There is an CelldataError Event ..use that and withinset
e.RaiseErrorEvent = False
If u want to retain the old value u set this prop
t = False
e.RestoreOriginalValue=true
to stay in edit mode
e.StayInEditMode
Hope this helps you ........
hppy koding ,
Arun
Now suppose if the user accidently enters a February date -> 02/29/2009 or 02/31/2009 or 02/31/2009, and instead of moving the focus somewhere else, clicks a button, which executes the UltraGrid1.UpdateData() method.
The UpdateData method will fail. It will give the following error "Value in the editor is not valid."
Let me know the solution for the same.
I am already using the following event of the UltraGrid.
private
{
try
e.RaiseErrorEvent =
MessageBox.Show(ErrorMessages.ValidValue, ExceptionConstants.MERCURY_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
e.RestoreOriginalValue =
e.StayInEditMode =
}
catch (Exception ex)
ErrorHandler.HandleGeneralException(ex);
It doesn't make any difference if the grid is updated because you moved to another row or because you clicked on a button and the grid lost focus. The event should still fire. If it's not firing, something is wrong.