private void gridView1_CellMerge(object sender, DevExpress.XtraGrid.Views.Grid.CellMergeEventArgs e)
{
if (e.Column.FieldName == "orderPrice")
{
GridView gridView = sender as GridView;
if (gridView != null)
{
Decimal value1 = (Decimal)gridView1.GetRowCellValue(e.RowHandle1, e.Column);
Decimal value2 = (Decimal)gridView1.GetRowCellValue(e.RowHandle2, e.Column);
e.Merge = value1 == value2;
e.Handled = true;
}
}
}
private void gv_docargo_CellMerge(object sender, DevExpress.XtraGrid.Views.Grid.CellMergeEventArgs e)
{
GridView view = sender as GridView;
string firstColumnFieldName = "INCIQCTRLID_GROUP";
string[] s = new string[] { "ALLOWWGT", "ALLOWQTY", "ALLOWCBM", "ALLOWQTYOVERRATE", "ALLOWWGTOVERRATE", "ALLOWCBMOVERRATE", "SAVEMAN", "SAVETIME", "APPROVEMAN", "APPROVETIME", "ALLOWTYPE" };
if (s.Contains(e.Column.FieldName))
{
string valueFirstColumn1 = Convert.ToString(view.GetRowCellValue(e.RowHandle1, view.Columns[firstColumnFieldName]));
string valueFirstColumn2 = Convert.ToString(view.GetRowCellValue(e.RowHandle2, view.Columns[firstColumnFieldName]));
string valueSecondColumn1 = Convert.ToString(view.GetRowCellValue(e.RowHandle1, view.Columns[e.Column.FieldName]));
string valueSecondColumn2 = Convert.ToString(view.GetRowCellValue(e.RowHandle2, view.Columns[e.Column.FieldName]));
if (!string.IsNullOrEmpty(valueFirstColumn1) || !string.IsNullOrEmpty(valueFirstColumn2))
{
e.Merge = valueFirstColumn1 == valueFirstColumn2 && valueSecondColumn1 == valueSecondColumn2;
e.Handled = true;
}
else
{
e.Merge = false;
e.Handled = true;
}
}
else
{
e.Merge = false;
e.Handled = true;
}
}