2024年终活动

DevExpress控件使用交流,DevExpress中国社区Dev联系电话 联系电话:023-68661681

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

来源:本站原创   发布时间:2012-10-17   浏览:3653次

下面的代码显示了如何利用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);
}


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



本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/385.html
扫码咨询
电话咨询
023-68661681
返回
顶部