This example creates an unbound column in the master GridView
and handles the CustomUnboundColumnData event to calculate the number of detail rows and display the number in the master row.
public Form1() {
// ...
gridControl1.ForceInitialize();
GridColumn col = gridView1.Columns.AddField("Tasks");
col.UnboundType = DevExpress.Data.UnboundColumnType.Integer;
col.Visible = true;
gridView1.CustomUnboundColumnData+=new DevExpress.XtraGrid.Views.Base.CustomColumnDataEventHandler(gridView1_CustomUnboundColumnData);
}
private void gridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e) {
GridView view = sender as GridView;
if (e.Column.FieldName != "Tasks") return;
if (!e.IsGetData) return;
DataRow row = ((view.DataSource as IList)[e.ListSourceRowIndex] as DataRowView).Row;
e.Value = row.GetChildRows("Project_Tasks").Length;
}
(you will be redirected to DevExpress.com to submit your response)