Version

RestoreOriginalValue Property

Whether to restore the value in the cell to original value. Default value is true.
Syntax
'Declaration
 
Public Property RestoreOriginalValue As Boolean
public bool RestoreOriginalValue {get; set;}
Remarks

RestoreOriginalValue indicates whether to restore the original value in the cell.

Example
Following code shows some of the information available in CellDataError event and the event's potential uses.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub UltraGrid1_CellDataError(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CellDataErrorEventArgs) Handles ultraGrid1.CellDataError

      ' CellDataError gets fired when the user attempts to exit the edit mode
      ' after entering an invalid value in the cell. There are several properties
      ' on the passed in event args that you can set to control the UltraGrid's
      ' behaviour.

      ' Typically ForceExit is false. The UltraGrid forces exits on cells under
      ' circumstances like when it's being disposed of. If ForceExit is true, then 
      ' the UltraGrid will ignore StayInEditMode property and exit the cell 
      ' restoring the original value ignoring the value you set to StayInEditMode
      ' property.
      If Not e.ForceExit Then
          ' Default for StayInEditMode is true. However you can set it to false to
          ' cause the grid to exit the edit mode and restore the original value. We
          ' will just leave it true for this example.
          e.StayInEditMode = True

          ' Set the RaiseErrorEvent to false to prevent the grid from raising 
          ' the error event and displaying any message.
          e.RaiseErrorEvent = False

          ' Instead display our own message.
          If Me.ultraGrid1.ActiveCell.Column.DataType Is GetType(DateTime) Then
              MessageBox.Show(Me, "Please enter a valid date.", "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Error)
          ElseIf Me.ultraGrid1.ActiveCell.Column.DataType Is GetType(Decimal) Then
              MessageBox.Show(Me, "Please enter a valid numer.", "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Error)
          End If
      Else
          ' Set the RaiseErrorEvent to false to prevent the grid from raising 
          ' the error event.
          e.RaiseErrorEvent = False
      End If

  End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void ultraGrid1_CellDataError(object sender, Infragistics.Win.UltraWinGrid.CellDataErrorEventArgs e)
{

	// CellDataError gets fired when the user attempts to exit the edit mode
	// after entering an invalid value in the cell. There are several properties
	// on the passed in event args that you can set to control the UltraGrid's
	// behaviour.

	// Typically ForceExit is false. The UltraGrid forces exits on cells under
	// circumstances like when it's being disposed of. If ForceExit is true, then 
	// the UltraGrid will ignore StayInEditMode property and exit the cell 
	// restoring the original value ignoring the value you set to StayInEditMode
	// property.
	if ( !e.ForceExit )
	{
		// Default for StayInEditMode is true. However you can set it to false to
		// cause the grid to exit the edit mode and restore the original value. We
		// will just leave it true for this example.
		e.StayInEditMode = true;
	    
		// Set the RaiseErrorEvent to false to prevent the grid from raising 
		// the error event and displaying any message.
		e.RaiseErrorEvent = false;

		// Instead display our own message.
		if ( this.ultraGrid1.ActiveCell.Column.DataType == typeof( DateTime ) )
		{
			MessageBox.Show( this, "Please enter a valid date.", "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Error );
		}
		else if ( this.ultraGrid1.ActiveCell.Column.DataType == typeof( decimal ) )
		{
			MessageBox.Show( this, "Please enter a valid numer.", "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Error );
		}
	}
	else
	{
		// Set the RaiseErrorEvent to false to prevent the grid from raising 
		// the error event.
		e.RaiseErrorEvent = false;
	}

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also