ComponentOne DataObjects for .NET
BeforeEndEdit Event (BaseDataTableSource)

C1.Data.2 Assembly > C1.Data Namespace > BaseDataTableSource Class : BeforeEndEdit Event
Fired when the user finishes editing a row, before the row leaves edit mode.
Syntax
'Declaration
 
Public Event BeforeEndEdit As RowChangeEventHandler
public event RowChangeEventHandler BeforeEndEdit
Event Data

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

PropertyDescription
The action that has occurred.  
The table object where the event has occurred.  
For a deleted row, in BaseLogic.AfterDelete event, the array of field values in the row before the row was deleted. This property is not set in events other than AfterDelete. This property must be used in BaseLogic.AfterDelete event to access row values because they are not accessible through regular row properties after the row has been deleted.  
For events BaseLogic.BeforeEndEdit, BaseLogic.AfterEndEdit, this property indicates whether the row has been modified while it was in edit mode. This property is often needed in BaseLogic.BeforeEndEdit/ BaseLogic.AfterEndEdit because data-bound controls begin edit mode when they position on a row and end edit mode when they leave the row, even if no changes have been made to the row in the process.  
Parent row.  
The row where the event has occurred.  
Remarks
Throwing an exception in this event prevents the row from leaving edit mode.

Use this event for validating changes done to a row, testing conditions that depend on multiple fields, so these conditions can be tested only when all the changes are done, the whole row changed, as opposed to conditions depending on a single field. The latter are usually tested in the BeforeFieldChange event. See also C1.Data.SchemaObjects.BaseTable.ConstraintsFieldLevel, and C1.Data.SchemaObjects.BaseTable.ConstraintsRecordLevel for alternative, codeless ways of specifying validation conditions.

Writing code handling edit mode events, take into account that in addition to explicit programmatic calls to C1DataRow.BeginEdit%M:C1.Data.C1DataRow.EndEdit%, edit mode is also used by data bound controls: when a row becomes current, it is automatically placed in edit mode (BeginEdit is called implicitly). When the user moves to another row, the row exits edit mode (EndEdit is called implicitly). For example, throwing and exception in BeforeEndEdit event will prevent bound controls from leaving the row.

If you want to test validation conditions only when the row has been changed while it was in edit mode and not when it was just moved to and out of edit mode without making changes, use the Modified argument to distinguish between these two cases.

See Also