Software Technology Tips

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();
            }
        }


Related Tags:

ASP.NET

Author: Rashmita Devi

ASP.NET

Let us Connect!

privacy
iso 9001 QA25 Nasscom Red Herring zinnov STPI iso 27001

copyright (c) Mindfire Solutions 2007-2013. Login