下列代码展示了如何通过 ColumnView.InitNewRow 事件初始化新建行中的“PurchaseDate”字段。
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);
}
|
Visual Basic | 复制代码 |
---|
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
|