Version

BeforeRowCancelUpdate Event

Occurs before the user cancels updates to a row by pressing the ESC key.
Syntax
'Declaration
 
Public Event BeforeRowCancelUpdate As CancelableRowEventHandler
public event CancelableRowEventHandler BeforeRowCancelUpdate
Event Data

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

PropertyDescription
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
Row The row that the cell belongs to (read-only)
Remarks

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

The cancel argument enables you to programmatically prevent the row'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 cells in a row. It is also generated when the CancelUpdate method is invoked.

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

Example
Following code prevents the user from accidently canceling row modifications by prompting a confirmation dialog. The user can cancel row modifications by hitting the Escape key twice on a row being edited.

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
Imports System.Diagnostics

   Private Sub UltraGrid1_BeforeRowCancelUpdate(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CancelableRowEventArgs) Handles ultraGrid1.BeforeRowCancelUpdate

       ' When the user modifies cells in a row and then hits Escape twice, the 
       ' changes in the row get canceled and this event gets fired.

       Dim result As DialogResult = MessageBox.Show( _
           "Are you sure you want to cancel changed you've made in the row ?", _
           "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

       If DialogResult.No = result Then
           e.Cancel = True
       Else
           Debug.WriteLine("Changes in row with index of " & e.Row.Index.ToString() & " has been discarded since last updated.")
       End If

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

private void ultraGrid1_BeforeRowCancelUpdate(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e)
{

	// When the user modifies cells in a row and then hits Escape twice, the 
	// changes in the row get canceled and this event gets fired.

	DialogResult result = MessageBox.Show( 
		"Are you sure you want to cancel changed you've made in the row ?",
		"Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question );

	if ( DialogResult.No == result )
	{
		e.Cancel = true;
	}
	else
	{
		Debug.WriteLine( "Changes in row with index of " + e.Row.Index.ToString( ) + " has been discarded since last updated." );
	}

}
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