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
close icon

Strange behaviour in CurrentCellChanged Event

Hi, again coming back to the CurrentCellChanged Event as I have already posted in the Thread http://www.syncfusion.com/forums/message.asp?MessageID=1795. I have continued playing around a bit with catching Cell Data changes immediately when they take place. I have tried it especially with the following CellTypes: TextBox, CheckBox, ComboBox, MonthCalendar. It seems strange to me because, I can collect the actual data having been entered either in different places or only after I Deactivate(false) the cell in question (MonthCalendar). If someone here could point me to a generic method of reading the CurrentCell's value from within the CurrentCellChanged() Event handler, I would really appreciate it. As noted in my other post I think it would make sense to have the current/new value available in the Renderer's CellValue property the time the Event Handler is entered. But maybe it's just me who is missing anything here, maybe use a different event?! Thanks for your help Regards Kai Iske DWS Investments

3 Replies

AD Administrator Syncfusion Team December 5, 2002 03:07 PM UTC

Hi Kai, CurrentCellChanged is raised when changes were made in the current cell while in editing mode. Immediately saving this changes as a cell value is not an option in most grid scenarios because it is only a temporary state of the edited cell. Before the cell value can be stored in the underlying cell it needs to be validated. This validation should only occur when the user is satisfied with his text entry and ok's it. You can force saving the data into the cell by calling CurrentCell.CommitChanges(). CommitChanges() will validate the cell contents and store the value in the cell style. The cell renderer will neither be deactivated nor loose focus. On a more general note: At the time CurrentCellChanged is raised the state of the current cells ControlValue is up to the specific cell editor. Optimal case will be that all cells save the CurrentCell.ControlValue based on the current text before CurrentCellChanged is raised, but it cannot be guaranteed that each cell renderer will do that. Most accurate is ControlText. It will return the text that is displayed in the cell but ControlValue must be explicitly generate by the renderer (and is only of use when you want to extend the cell type). We will try to make all our cell editor do that and generate a CurrentCell.ControlValue before CurrentCellChanged is raised in future when approbriate (e.g. it definitely makes sense for the combobox DisplayMember/ValueMember pair). Stefan


AD Administrator Syncfusion Team December 5, 2002 03:36 PM UTC

BTW - do you have source code? I yes, if you are interested just open a direct trac incident and I can mail you a corrected combobox renderer that will set the value before CurrentCellChanged is raised and I can also look at other renderers. Stefan


KI Kai Iske December 6, 2002 03:28 AM UTC

> BTW - do you have source code? I yes, if you are interested just open a direct trac incident and I can mail you a corrected combobox renderer that will set the value before CurrentCellChanged is raised and I can also look at other renderers. > > Stefan Stefan, I think I will first try to go down the CommitChanges() path and will extract the actual value after that. I assume it is safe to call CommitChanges() in CurrentCellChanged. Thanks for the thorough explanation you have given me. Sheds a bit of light onto things and I'm looking forward to the changes being applied to make things consistent, where possible. Regards Kai

Loader.
Live Chat Icon For mobile
Up arrow icon