aspnet-devexpress-dot-web-dot-aspxgridview-96604902.md
Enables you to initialize added rows.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public event ASPxDataInitNewRowEventHandler InitNewRow
Public Event InitNewRow As ASPxDataInitNewRowEventHandler
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. |
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.
This example handles the ASPxGridView.InitNewRow event to initialize the new record’s field values with default values.
The image below shows the result:
protected void grid_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e) {
e.NewValues["BirthDate"] = new DateTime(1970, 1, 10);
e.NewValues["Title"] = "Sales Representative";
}
Protected Sub ASPxGridView1_InitNewRow(ByVal sender As Object,_
ByVal e As DevExpress.Web.Data.ASPxDataInitNewRowEventArgs) Handles ASPxGridView1.InitNewRow
e.NewValues("BirthDate") = New DateTime(1970, 1, 10)
e.NewValues("Title") = "Sales Representative"
End Sub
See Also