Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
AfterExitEditMode and cell.Value
posted

Hi,

I have a grid with some datetime columns, which can be changed by the user by a calendar control. Whenever the AfterExitEditMode occurs I update the value in the database.

But when the user changes the value and clicks to another control outside the grid, the Value property of the active cell is null. I think the grid will call CancelUpdate when the focus got lost. Is there a way to get the new value in this situation?

 

  • 12333
    posted

    Hi there,

     

    Sure you can :) In the situation where it works, once the user moves to another cell / row in WinGrid, it is causing the cell.Text to be pushed into the cell.Value, which is then pushed into your underlying data object's property. When someone just clicks off WinGrid while a cell is still in edit mode the same thing does not happen. It will be up to you to do either of the following:

     

    - look at the Active Cell's Text property

    or

    - use the following code when WinGrid loses focus to programmatically invoke the same action as clicking off a cell / row so that you can THEN get the Cell.Value:

                //Simulates moving off the cell so that the value in the grid editor gets put into the
                //underlying object's property
                this.ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode);
                //commits the value changes to the current list object
                this.ultraGrid1.UpdateData();

                //then resolve the changes to your database.