Skip to main content
A newer version of this page is available. .
Tab

ASPxGridView.InitNewRow Event

Enables you to initialize added rows.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v19.1.dll

Declaration

public event ASPxDataInitNewRowEventHandler InitNewRow

Event Data

The InitNewRow event's data class is ASPxDataInitNewRowEventArgs. The following properties provide information specific to this event:

Property Description
NewValues Gets a dictionary that contains the new field name/value pairs for the new row.

Remarks

The InitNewRow event is raised when a new row is added to the ASPxGridView. This occurs when:

Use the event parameter’s NewValues property to specify the values in the new row. Note that you can initialize values only for those columns that are visible within the Edit Form or In-Line Edit Row. To specify values of hidden columns, handle the ASPxGridView.RowInserting event.

Example

In this example the ASPxGridView.InitNewRow event is handled to initialize the new record’s field values with default values.

The image below shows the result:

exInitNewRow

protected void grid_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e) {
    e.NewValues["BirthDate"] = new DateTime(1970, 1, 10);
    e.NewValues["Title"] = "Sales Representative";
}
See Also