//To set the back colors for the records
this.gridGroupingControl1.QueryCellStyleInfo += gridGroupingControl1_QueryCellStyleInfo;
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if(e.TableCellIdentity.RowIndex == row && highlight)
{
e.Style.BackColor = Color.Green;
}
if(rowCollection.Contains(e.TableCellIdentity.RowIndex))
{
//Set the color for Duplicate values
e.Style.BackColor = Color.LightGreen;
}
}
int row, col;
int[] rowCollection = new int[10];
bool highlight = false;
private void button1_Click(object sender, EventArgs e)
{
highlight = true;
row = this.gridGroupingControl1.TableControl.CurrentCell.RowIndex;
//For validating the data
string data = this.gridGroupingControl1.Table.CurrentRecord.GetValue("No").ToString();
foreach(Record rec in this.gridGroupingControl1.Table.Records)
{
int i=0;
if(rec.GetValue("No").ToString() == data && rec.GetRowIndex() != row)
{
rowCollection[i] = rec.GetRowIndex();
i++;
}
}
this.gridGroupingControl1.Refresh();
}
|