BeforeCellEnterEditMode Event

Occurs before an edit mode session begins on an UltraTreeNodeCell.
Public Event BeforeCellEnterEditMode As BeforeCellEnterEditModeEventHandler
public event BeforeCellEnterEditModeEventHandler BeforeCellEnterEditMode
Event Data

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

Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
Cell (Inherited from Infragistics.Win.UltraWinTree.CancelableCellEventArgs)Returns the UltraTreeNodeCell object for which this instance was created.
Column (Inherited from Infragistics.Win.UltraWinTree.CancelableCellEventArgs)Returns the UltraTreeNodeColumn for which this instance was created.
Node (Inherited from Infragistics.Win.UltraWinTree.CancelableCellEventArgs)Returns the UltraTreeNode for which this instance was created.
The following code sample demonstrates how to use the BeforeCellEnterEditMode event to conditionally prevent the end user from editing a cell based on external criteria:

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

    Private Sub ultraTree1_BeforeCellEnterEditMode(ByVal sender As Object, ByVal e As BeforeCellEnterEditModeEventArgs) Handles ultraTree1.BeforeCellEnterEditMode

        If e.Column.Key = "Address" Then

            Dim cellValue As Object = e.Cell.Value
            If cellValue Is Nothing Or cellValue Is System.DBNull.Value Then

                Dim status As Object = e.Node.Tag
                If Not status Is Nothing And status = "DO_NOT_CHANGE_EMPTY_VALUES" Then
                    e.Cancel = True
                    MessageBox.Show("Cell value cannot be modified.", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Stop)
                End If
            End If

        End If

    End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinTree;
using System.Diagnostics;

		private void ultraTree1_BeforeCellEnterEditMode(object sender, Infragistics.Win.UltraWinTree.BeforeCellEnterEditModeEventArgs e)
			if ( e.Column.Key == "Address" )
				object cellValue = e.Cell.Value;
				if ( cellValue == null || cellValue == System.DBNull.Value )
					object status = e.Node.Tag;
					if ( status != null && status is string && (string)status == "DO_NOT_CHANGE_EMPTY_VALUES" )
						e.Cancel = true;
						MessageBox.Show( "Cell value cannot be modified.", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Stop );


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