Occurs before an edit mode session begins on an
UltraTreeNodeCell.
Syntax
Example
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.
| Visual Basic | Copy Code |
|---|
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
|
| C# | Copy Code |
|---|
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 );
}
}
}
}
|
See Also