ComponentOne DataObjects for .NET
AfterAddNew Event (BaseDataTableSource)

C1.Data.2 Assembly > C1.Data Namespace > BaseDataTableSource Class : AfterAddNew Event
Fired after a new (empty) row is added.
Syntax
'Declaration
 
Public Event AfterAddNew As RowChangeEventHandler
public event RowChangeEventHandler AfterAddNew
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
This event can be used to fill default values of the fields according to some rules that cannot be specified as simple values of the C1.Data.SchemaObjects.Field.DefaultValue property. It can also be used to specify the primary key values, see Keys Assigned by Client: New Row Detached and Attached State. The ParentRow argument is used in AfterAddNew event on the data set level (in a C1DataSetLogic component), in a master-detail situation. When a new row is added to the child (detail) table view, this argument contains the parent row to which the new child row belongs. Under other circumstances and in other events this argument contains null. This argument is necessary because in this case parent row cannot be found using the C1DataRow.GetParentRow, as the new row is yet in detached state, see Keys Assigned by Client: New Row Detached and Attached State. C1DataRow.GetParentRow becomes accessible only in the AfterEndAddNew event.
See Also