首页 > 代码库 > DevExpress XtraGrid网格控件示例四:初始化新建行的单元格

DevExpress XtraGrid网格控件示例四:初始化新建行的单元格

下面的代码显示了如何利用ColumnView.InitNewRow事件初始化新创建行的PurchaseDate字段:

C#

1 using DevExpress.XtraGrid.Views.Grid;2 private void gridView1_InitNewRow(object sender, InitNewRowEventArgs e) {3 DevExpress.XtraGrid.Views.Grid.GridView view = sender as Grid.GridView;4 view.SetRowCellValue(e.RowHandle, view.Columns["PurchaseDate"], DateTime.Today);5 }
View Code