Skip to main content

VGridControlBase.InitNewRecord Event

Enables added records to be initialized.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v23.2.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid


public event RecordIndexEventHandler InitNewRecord

Event Data

The InitNewRecord event's data class is DevExpress.XtraVerticalGrid.Events.RecordIndexEventArgs.


The InitNewRecord event is raised when a new record is added to the vertical grid. A new record can be added using the grid’s VGridControlBase.AddNewRecord method. End-users can do this using the Append button of the data navigator which is bound to the same data source as the vertical grid.

The cells within the new record can automatically be initialized (depending upon the data source). For instance, the key field value may already be assigned. Cells that are not initialized automatically will be displayed as empty. Handle the InitNewRecord event to manually initialize such cells.

The new record is identified by the event parameter’s RecordIndex property.


The following code shows how to initialize the “ID” field of a new record via the VGridControlBase.InitNewRecord event.

using DevExpress.XtraVerticalGrid;
using DevExpress.XtraVerticalGrid.Events;

// ...
private void vGridControl1_InitNewRecord(object sender, RecordIndexEventArgs e) {
   Vertical Grid Control vGrid = sender as VGridControl;
   vGrid.SetCellValue(vGrid.Rows.GetRowByFieldName("ID", true), 
     e.RecordIndex, vGrid.RecordCount);
See Also