how can I cancel the edit mode programmatically in Inline edit mode?
1 Answer, 1 is accepted
1
Accepted
Apostolos
Telerik team
answered on 07 Dec 2021, 03:27 PM
Hi Robert,
It is possible to exit edit mode programmatically, without using the default Cancel button.
To achieve this, you can use the Grid State. We have a section that shows how to initiate editing. In your case, you will do the opposite - set the following Grid state properties to null:
InsertedItem
EditItem
OriginalEditItem
The code snippet bellow uses an OnClick event handler as an example. Note that the edited item will not be saved.
A suggestion: why not to provide a simple public method on the Grid?
Apostolos
Telerik team
commented on 08 Dec 2021, 04:11 PM
Hello Robert,
Normally, the Grid Cancel command allows users to cancel changes in inline edit mode. It appears that it is not suitable for your case.
I would like to get more details about your scenario and what brings the need to exit edit mode programmatically. This will allow us to understand your needs better.