Hi experts,
The problem is like this, i have a ultragrid bound to a data class. there are 3 columns A , B and C in this grid. Columns A and B are editable while C is readonly. there is a relationship between them C = A + B. So after user input new value into A or B, the column C need to be updated immdiately.
i had tried lots of methods like update data class or cell C UI in AfterCellUpdate event handler but failed, could any body give any hints? thanks.
xiaolong
private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e) { e.Row.Cells["C"].Value = (int)e.Row.GetCellValue("A") + (int)e.Row.GetCellValue("B"); }
You could try using a formula field to do this, however Not sure why your Aftercellupdate would not work provided you are using .value or the setvalue function, unless you have told it to re-load the grid from your datasource after update but without changing your data source.
The other thing to be aware of though setting the value triggers aftercellupdate event again, so you want to put a check in there so it does nothing if the current cell.column.key value is 'C'.