We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Populate CellValue based on another cell in the row

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; } }

1 Reply

AD Administrator Syncfusion Team January 12, 2004 04:55 PM UTC

Try this. Before doing g[r,2].CellValue = g[r, 1].Text;, try calling g.Binder.BeginEdit() to see if this takes care of the problem.

Live Chat Icon For mobile
Up arrow icon