Version

BeforeRowUpdate Event

Occurs before a row is updated, meaning changes made to its cells are actually committed to the data source.
Syntax
'Declaration
 
Public Event BeforeRowUpdate As CancelableRowEventHandler
public event CancelableRowEventHandler BeforeRowUpdate
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 that will be updated. 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 from being updated and from committing changes to the data source. This argument can be used to prevent the row from being updated unless a certain condition is met.

This event is generated when a row is updated, meaning changes made to its cells are actually committed to the data source. Note that this is not necessarily when the row loses focus, since various factors such as the type of record locking employed by the data source, as well as the value of the UpdateMode property, can affect when the update occurs. The BeforeCellUpdate event is generated when a cell is accepting a new value.

To prevent the user from making changes to a cell, set the AllowUpdate property to 2 (AllowUpdateNo). A cell's value can be changed programmatically by setting its Value property.

A row can be updated programmatically by invoking its Update method.

The AfterRowUpdate event, which occurs after a row is updated, is generated after this event, provided cancel is not set to True.

Example
Following code shows some of the information available in BeforeRowUpdate 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
Imports System.Diagnostics

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

       ' Setting the Cancel to true will cause the grid to cancel the update. More precisely, it
       ' will call CancelUpdate on row objects.

       Debug.WriteLine("Canceling the row update on row with list index of " & e.Row.ListIndex)

       e.Cancel = True

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

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

	// Setting the Cancel to true will cause the grid to cancel the update. More precisely, it
	// will call CancelUpdate on row objects.

	Debug.WriteLine( "Canceling the row update on row with list index of " + e.Row.ListIndex );

	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