1 private void gv_docargo_CellMerge(object sender, DevExpress.XtraGrid.Views.Grid.CellMergeEventArgs e) 2 { 3 4 GridView view = sender as GridView; 5 string firstColumnFieldName = "INCIQCTRLID_GROUP"; 6 string[] s = new string[] { "ALLOWWGT", "ALLOWQTY", "ALLOWCBM", "ALLOWQTYOVERRATE", "ALLOWWGTOVERRATE", "ALLOWCBMOVERRATE", "SAVEMAN", "SAVETIME", "APPROVEMAN", "APPROVETIME", "ALLOWTYPE" }; 7 8 if (s.Contains(e.Column.FieldName)) 9 { 10 string valueFirstColumn1 = Convert.ToString(view.GetRowCellValue(e.RowHandle1, view.Columns[firstColumnFieldName])); 11 string valueFirstColumn2 = Convert.ToString(view.GetRowCellValue(e.RowHandle2, view.Columns[firstColumnFieldName])); 12 13 string valueSecondColumn1 = Convert.ToString(view.GetRowCellValue(e.RowHandle1, view.Columns[e.Column.FieldName])); 14 string valueSecondColumn2 = Convert.ToString(view.GetRowCellValue(e.RowHandle2, view.Columns[e.Column.FieldName])); 15 if (!string.IsNullOrEmpty(valueFirstColumn1) || !string.IsNullOrEmpty(valueFirstColumn2)) 16 { 17 e.Merge = valueFirstColumn1 == valueFirstColumn2 && valueSecondColumn1 == valueSecondColumn2; 18 e.Handled = true; 19 } 20 else 21 { 22 e.Merge = false; 23 e.Handled = true; 24 } 25 } 26 else 27 { 28 e.Merge = false; 29 e.Handled = true; 30 } 31 }