Version

BeforeCellCancelUpdate Event

Occurs before the user cancels changes to a cell's value by pressing the ESC key.
Syntax
'Declaration
 
Public Event BeforeCellCancelUpdate As CancelableCellEventHandler
public event CancelableCellEventHandler BeforeCellCancelUpdate
Event Data

The event handler receives an argument of type CancelableCellEventArgs containing data related to this event. The following CancelableCellEventArgs properties provide information specific to this event.

PropertyDescription
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
Cell Returns a reference to the cell of interest.
Remarks

The cell argument returns a reference to an UltraGridCell object that can be used to set properties of, and invoke methods on, the cell whose update is about to be canceled. You can use this reference to access any of the returned cell's properties or methods.

The cancel argument enables you to programmatically prevent the cell's update from being canceled. This argument can be used to prevent the user from canceling an update unless a certain condition is met.

This event is generated when the user presses the ESC key to cancel changes made to a cell's value. It is not generated when the CancelUpdate method is invoked.

The AfterCellCancelUpdate event, which occurs after a cell's update has been canceled, is generated after this event, provided cancel is not set to True.

Example
Following code shows properties available in BeforeCellCancelUpdate event.

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_BeforeCellCancelUpdate(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CancelableCellEventArgs) Handles ultraGrid1.BeforeCellCancelUpdate

      ' Following code illustrates how one can use BeforeCellCancelUpdate to revert
      ' the cell's value to its original value and at the same time keep the cell in 
      ' edit mode. Normally, when Escape key is hit, the UltraGrid restores the value
      ' in the cell being edited and exits the edit mode. There may be times where
      ' exiting the edit mode is not desired. BeforeCellCancelUpdate event can be 
      ' used to facilitate such behaviour.

      ' Set the Value of the editor to the cell's value. This will restore the value
      ' to the cell's original value. Remember, UltraGridCell.Value property returns
      ' the value in the underlying binding list.
      e.Cell.Column.Editor.Value = e.Cell.Value

      ' Now set the Cancel to true so the grid doesn't proceed with exiting the edit
      ' mode.
      e.Cancel = True

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

private void ultraGrid1_BeforeCellCancelUpdate(object sender, Infragistics.Win.UltraWinGrid.CancelableCellEventArgs e)
{

	// Following code illustrates how one can use BeforeCellCancelUpdate to revert
	// the cell's value to its original value and at the same time keep the cell in 
	// edit mode. Normally, when Escape key is hit, the UltraGrid restores the value
	// in the cell being edited and exits the edit mode. There may be times where
	// exiting the edit mode is not desired. BeforeCellCancelUpdate event can be 
	// used to facilitate such behaviour.

	// Set the Value of the editor to the cell's value. This will restore the value
	// to the cell's original value. Remember, UltraGridCell.Value property returns
	// the value in the underlying binding list.
	e.Cell.Column.Editor.Value = e.Cell.Value;

	// Now set the Cancel to true so the grid doesn't proceed with exiting the edit
	// mode.
	e.Cancel = true;

}
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