This is a migrated thread and some comments may be shown as answers.

[Solved] Cancel row editing

4 Answers 259 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Serhiy Volhushyn
Top achievements
Rank 1
Serhiy Volhushyn asked on 18 Dec 2009, 04:39 PM
Build 2009.3.1208

Grid property ValidationMode="Row"

Start editing row
Modify value in the first cell -> hit "Tab" -> modify value in the next cell and hit "ESC"
It will cancel only the last cell and restore its old value, but the first cell (and binded object) now .contains a new value.
Is there any way to cancel the whole row and restore all values for all edited cells ?

Original Row
After Edit - Before ESC
After ESC

UPDATE:
I know I can subscribe to "PropertyChanged" and remember "CurrentItem".
Now in "RowEditEnded" I can copy all remembered properties back to the binded object.
For some reasons it is not suitable for our project,

4 Answers, 1 is accepted

Sort by
0
Accepted
Nedyalko Nikolov
Telerik team
answered on 22 Dec 2009, 02:34 PM
Hi Serhiy Volhushyn,

Thanks for pointing this out. We will add this feature for the next official release or service pack. Meanwhile you can do this by using IEditableObject interface. RadGridView calls IEditableObject.EndEdit() when edit is canceled.

All the best,
Nedyalko Nikolov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Serhiy Volhushyn
Top achievements
Rank 1
answered on 23 Dec 2009, 02:52 PM
Thank you, implementing IEditableObject works.
But there is the problem, it will call IEditableObject.CancelEdit and object original values will be restored, but it will still display old values in grid unless i call grid.Rebind()
0
Accepted
Stefan Dobrev
Telerik team
answered on 28 Dec 2009, 03:42 PM
Hello Serhiy,

In your implementation of IEditableObject.CancelEdit() you should make sure than when you restore the old values you correctly raise PropertyChange event for each value that has been restored. This way the grid will correctly update its cell values.

Sincerely yours,
Stefan Dobrev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Serhiy Volhushyn
Top achievements
Rank 1
answered on 28 Dec 2009, 07:31 PM
Thank you, after implementing all necessary interfaces it works perfectly.
Tags
GridView
Asked by
Serhiy Volhushyn
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Serhiy Volhushyn
Top achievements
Rank 1
Stefan Dobrev
Telerik team
Share this question
or