I have a grid control that I populate using PopulateValues and giving it an array datasource. I have a CurrentCellCloseDropDown event in which I try to compare the newly select value with the previously selected value of the cell. I can get the newly selected value of the cell by doing:
GridCurrentCell cc = m_GridControl.CurrentCell;
However, I can''t find where the previous value of the cell is stored. When I look at the grid control or the datasource using indexers, they always have the initial values and not any of the new values. Where are user changed values stored for the cells?
ADAdministrator Syncfusion Team August 16, 2004 04:14 PM
Using an indexer on the gridControl should return any changed value (after you have moved off the cell).
string oldValue = this.m_gridControl[cc.RowIndex,cc.ColIndex].Text;
JTJames TranAugust 17, 2004 06:31 AM
I must be doing something wrong but that doesn''t work for me. I have attached a sample project. To got row 23 in the grid and change the second dropdown. A break point has already been set in the event. I still get the old value and not the new value. Change it again and you will still see the original value and not either of the two new values.
ADAdministrator Syncfusion Team August 17, 2004 06:50 AM
You should get the old value at this point. (Your orignail post described not being able to get the old value???)
The indexer gives you the old value while the cell is actively being edited. The newvalue is not moved to the grid until you leave the cell (or call cc.ConfirmChanges()).
When the cell is actively being edited, you can get the new value using cc.Renderer.ControlText.
GridCurrentCell cc = gridControl1.CurrentCell;
object oldValue = gridControl1[cc.RowIndex, cc.ColIndex].CellValue;
object newValue = cc.Renderer.ControlText;
Console.WriteLine(oldValue + " " + newValue);