标签:
gridcontrol分组后可以显示分组列名、值 以及汇总项,但是想再显示其他列的值就需要使用自定义分组头了,如下所示:
private void bandedGridView2_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e)
{
GridGroupRowInfo GridGroupRowInfo = e.Info as GridGroupRowInfo;
GridView gridview = sender as GridView;
int index = gridview.GetDataRowHandleByGroupRowHandle(e.RowHandle);
GridGroupRowInfo.GroupText=GridGroupRowInfo.GroupText.Replace("(已审核)", "");
GridGroupRowInfo.GroupText=GridGroupRowInfo.GroupText.Replace("(未审核)", "");
GridGroupRowInfo.GroupText += "(" + (gridview.GetRowCellValue(index, "SHFLAG").Equals("Y") ? "已审核" : "未审核") + ")";
}
其中,因为在重画过程中,当采用groupText+= 这样的赋值模式时,对之前的值都会累计,会产生重复的垃圾数据,这是可以在语句之前,使用Replace去除重复的值
最终效果如下:
标签:
原文地址:http://www.cnblogs.com/xiaoxihebei/p/5863039.html