Version

CellDataUpdating Event

Fired before a control bound to this UltraDataSource attempts to update a cell's value.
Syntax
'Declaration
 
Public Event CellDataUpdating As CellDataUpdatingEventHandler
public event CellDataUpdatingEventHandler CellDataUpdating
Event Data

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

PropertyDescription
CacheData Specifies whether to cache the data. Default value is true. Set this to false if you want to prevent the UltraDataSource from keeping the data. If there is some existing data that's cached for the column, it will be cleared. CellDataRequested event will be fired the next time the data for the cell is needed.
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
Column Gets the column.
NewValue New value of the cell. You can set this to a different value.
Row Gets the row.
Remarks

CellDataUpdating is fired before a control bound to this UltraDataSource attempts to update a cell's value. You can cancel the update by setting Cancel to true off the CellDataUpdatingEventArgs in which case the original value will be retained. You can also alter the update value by setting CellDataUpdatingEventArgs.NewValue to a different value.

By default the UltraDataSource will cache the new value of the cell. If you are managing the data then you may want to prevent the UltraDataSource from caching the value by setting CellDataUpdatingEventArgs.CacheData to false.

Note that this event is not be fired when you set the value in code.

Example
Following code shows some of the information available in CellDataUpdating and CellDataUpdated events and typical usages for these events.

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.UltraWinDataSource
Imports Infragistics.Win.UltraWinGrid


    Private Sub UltraDataSource1_CellDataUpdating(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinDataSource.CellDataUpdatingEventArgs) Handles UltraDataSource1.CellDataUpdating
        ' CellDataUpdating is fired when a field is modified in a control bound
        ' to this data source. Typically you update the external data source with
        ' the new value if there is an external data source.

        Debug.WriteLine( _
         e.Column.Key & " field " & " in row " & e.Row.Index _
         & " is being updated to new value of " & e.NewValue.ToString())

        ' If there is an external data source that's being used to provide the
        ' data to the ultradata source and that external data source is updated
        ' with the new value, you would set the CacheData to false since you 
        ' don't want the UltraDataSource to keep the value.
        e.CacheData = False

        ' You can also set the Cancel to true to prevent the UltraDataSource 
        ' from updating with the new value.
        e.Cancel = True
    End Sub

    Private Sub UltraDataSource1_CellDataUpdated(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinDataSource.CellDataUpdatedEventArgs) Handles UltraDataSource1.CellDataUpdated
        ' CellDataUpdated is fired after CellDataUpdating is fired.

        Debug.WriteLine( _
         e.Column.Key & " field " & " in row " & e.Row.Index _
         & " is updated to new value of " & e.NewValue.ToString())
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinDataSource;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;


		private void ultraDataSource1_CellDataUpdating(object sender, Infragistics.Win.UltraWinDataSource.CellDataUpdatingEventArgs e)
		{
			// CellDataUpdating is fired when a field is modified in a control bound
			// to this data source. Typically you update the external data source with
			// the new value if there is an external data source.
			
			Debug.WriteLine(
				e.Column.Key + " field " + " in row " + e.Row.Index 
				+ " is being updated to new value of " + e.NewValue.ToString( ) );

			// If there is an external data source that's being used to provide the
			// data to the ultradata source and that external data source is updated
			// with the new value, you would set the CacheData to false since you 
			// don't want the UltraDataSource to keep the value.
			e.CacheData = false;

			// You can also set the Cancel to true to prevent the UltraDataSource 
			// from updating with the new value.
			e.Cancel = true;
		}

		private void ultraDataSource1_CellDataUpdated(object sender, Infragistics.Win.UltraWinDataSource.CellDataUpdatedEventArgs e)
		{
			// CellDataUpdated is fired after CellDataUpdating is fired.

			Debug.WriteLine(
				e.Column.Key + " field " + " in row " + e.Row.Index 
				+ " is updated to new value of " + e.NewValue.ToString( ) );
		}
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