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

Lost focus of cell

After editing data on a cell, if the user moves to a different control on the form say a button, the newly entered data is not accepted by the grid. Example : Enter a value “123” in cell1 of DataBoundgrid -->>If the user moves out by using the mouse and clicking on a button on the grid then the cell has the original value and not “123”. However, if we enter a value “123” in cell1 of DataBoundgrid and moves out by using the tab/arrow/Enter key the cell retains the value as “123”. Could you suggest a solution to force the lost focus of the cell. We have tried to use MoveTo() method on the button click before performing the action but that doesnot work.

2 Replies

AD Administrator Syncfusion Team July 22, 2004 07:48 AM UTC

This is not standard behavior. For example, I do not see it in this sample that has a GridDataBoundGrid and a Button on a form. ForumSampleFocus_3764.zip So, to get things to work, you may have to identify what is interfering with the default behavior. The normal things you can do to force the grid to save values would be to call grid.CurrentCell.EndEdit(); grid.Binder.EndEdit(); But this may not be sufficient if there is something interfering with the saving process. You might try listening to the grid.Leave event and see if that is being hit in this case. If so, you could try doing the two calls above to see if that handles things. You might look through your code for calls to CancelEdit as that would be something that would throw away changes and restore the old value.

KK Kewalramani Kanchan July 22, 2004 08:29 AM UTC

Thanks Clay......we were able to acheive the same using the grid.Leave event.

Live Chat Icon For mobile
Up arrow icon