Home Forums WinForms controls Xceed Grid for WinForms Using CellValueChanged in a bound grid Reply To: Using CellValueChanged in a bound grid

User (Old forums)
Member
Post count: 23064

You could use the ValueChanged event available on the Cell class, verify the value of the cell in the event handler, and change the row BackColor accordingly to the value. You can subscribe to this event only for the cells in a specific column, so it will fire only for cells for which you need to check value changes.

e.g.

private void Form1_Load(object sender, System.EventArgs e)
{
dataRowTemplate1.Cells[ “EmployeeID” ].ValueChanged += new EventHandler(EmployeeID_ValueChanged);
//then fill the grid with data
}

private void EmployeeID_ValueChanged(object sender, EventArgs e)
{
Cell cell = sender as Cell;
if( cell.Value.ToString() == “1” )
{
cell.ParentRow.BackColor = Color.Red;
}

Imported from legacy forums. Posted by André (had 262 views)