I am trying to link 2 cells together. Basically, if you select from the drop down in column 1 the value in column 2 is automatically populated and vice versa. I am using the CurrentCellEditingComplete() event - I included the code below. Everything is working as expected except one thing. When I tab out of the column 1 cell into the column 2 cell, a new row is created. Why would this happen?
Thanks!
Christina
private void grid_CurrentCellEditingComplete(object sender, System.EventArgs e)
{
GridDataBoundGrid g = (GridDataBoundGrid) sender;
int c = g.CurrentCell.ColIndex;
int r = g.CurrentCell.RowIndex;
switch(c)
{
case 1:
if(g[r, 1].Text != g[r,2].FormattedText)
{
g[r,2].CellValue = g[r, 1].Text;
}
break;
case 2:
if(g[r, 2].Text != g[r,1].FormattedText)
{
g[r,1].CellValue = g[r, 2].Text;
}
break;
}
}