'Declaration Public Event BeforeCellUpdate As BeforeCellUpdateEventHandler
public event BeforeCellUpdateEventHandler BeforeCellUpdate
The event handler receives an argument of type BeforeCellUpdateEventArgs containing data related to this event. The following BeforeCellUpdateEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Cancel (Inherited from System.ComponentModel.CancelEventArgs) | |
Cell | The cell (read-only) |
NewValue | The new value of the cell (read-only) |
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 value will be modified. You can use this reference to access any of the returned cell's properties or methods. However, the Value property of this cell is read-only.
The newvalue argument indicates what the new value of the cell will be. The Value property of the UltraGridCell object returned by cell can be used to determine the existing value of the cell.
The cancel argument enables you to programmatically prevent the cell from accepting the new value. This argument can be used to prevent the cell from accepting the new value unless a certain condition is met.
This event is generated when a cell's value has been changed, either programmatically, or by user interaction. Note that the cell's new value is not necessarily committed to the data source at this time, 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 BeforeRowUpdate event is generated when the new value is to be committed to the data source.
A cell's value can be changed programmatically by setting its Value property. Attempting to set the Value property of the cell whose value will be modified in this event procedure, however, will generate an error.
The AfterCellUpdate event, which occurs after a cell accepts a new value, is generated after this event, provided cancel is not set to True.
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Imports System.Diagnostics Private Sub UltraGrid1_BeforeCellUpdate(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs) Handles ultraGrid1.BeforeCellUpdate ' When the user modifies the value in a cell and exits the edit mode on that cell, ' the UltraGrid fires this event and if it's not canceled, updates the bound ' data source with the new value. If it's cancelled, then the grid doesn't update ' the cell and contents of the cell will revert back to the original value. If e.Cell.Column.Key = "OrderDate" Then If e.NewValue Is DBNull.Value Then Debug.WriteLine("Cell is being updated with DBNull") Else Debug.WriteLine("Cell is being updated with " & e.NewValue.ToString()) End If End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void ultraGrid1_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e) { // When the user modifies the value in a cell and exits the edit mode on that cell, // the UltraGrid fires this event and if it's not canceled, updates the bound // data source with the new value. If it's cancelled, then the grid doesn't update // the cell and contents of the cell will revert back to the original value. if ( e.Cell.Column.Key == "OrderDate" ) { if ( e.NewValue == DBNull.Value ) Debug.WriteLine( "Cell is being updated with DBNull" ); else Debug.WriteLine( "Cell is being updated with " + e.NewValue.ToString( ) ); } }
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