If you need to customize the Group Text during runtime then you can handle the GridView’s CustomDrawGroupRow event.
|
Let’s say you have a GridView and you are grouping the data according to Project Number. But while showing the group text you want to show both Project Number and Project Name (ex. 001 – Demo Project). Where ‘001’ is the project number and ‘Demo Project’ is the name of the project.
First of all you have to set gcProjectNo.GroupIndex = 0;
Then you have to handle the CustomDrawGroupRow event.
|
private void grdvProjectList_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { GridView view = sender as GridView; DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo info = e.Info as DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo; int handle = view.GetDataRowHandleByGroupRowHandle(e.RowHandle); if (info.Column.FieldName == "PRJ_NO") { StringBuilder oGroupText = new StringBuilder(); oGroupText.Append(view.GetRowCellValue(handle, "PRJ_NO").ToString()); oGroupText.Append(" - "); oGroupText.Append(view.GetRowCellValue(handle, "PRJ_NAME").ToString()); info.GroupText = oGroupText.ToString(); } }