增加一個record count 欄位

  • 812
  • 0

摘要:增加一個record count 欄位

var col = gridView1.Columns.Add(); 
col
.FieldName = "count"; 
col
.Visible = true; 
col
.UnboundType = DevExpress.Data.UnboundColumnType.Integer;  // 這行一定要, 不然跑不出來
gridView1
.CustomUnboundColumnData += gridView1_CustomUnboundColumnData; 
 

void gridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e) 
{ 
   
if (e.Column.FieldName =="count")  e.Value = e.ListSourceRowIndex+1; 
}