The following code shows how to initialize the "PurchaseDate" field of a new row via the ColumnView.InitNewRow event.
C#
using DevExpress.XtraGrid.Views.Grid;
private void gridView1_InitNewRow(object sender, InitNewRowEventArgs e) {
DevExpress.XtraGrid.Views.Grid.GridView view = sender as Grid.GridView;
view.SetRowCellValue(e.RowHandle, view.Columns["PurchaseDate"], DateTime.Today);
}
VB
Imports DevExpress.XtraGrid.Views.Grid
Private Sub GridView1_InitNewRow(ByVal sender As Object, _
ByVal e As InitNewRowEventArgs) Handles GridView1.InitNewRow
Dim view As GridView = CType(sender, GridView)
view.SetRowCellValue(e.RowHandle, view.Columns("PurchaseDate"), DateTime.Today)
End Sub
No comments:
Post a Comment