View Single Post
  #3 (permalink)  
Old April 14th, 2010, 10:04 AM
elizas elizas is offline
Authorized User
 
Join Date: Jan 2010
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to elizas
Default How to Customize the Group Text of a DevExPress Grid View

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.RowObjectCustomDraw EventArgs e)
{
GridView view = sender as GridView;

DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupR owInfo info =
e.Info as DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupR owInfo;

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();
}
}
Hope this would be useful.Any suggestions are welcomed.
__________________
Cheers,
Eliza

Mindfire: India's Only Company to be both Apple Premier & Microsoft Gold certified.