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

CancelEdit() for GridViewRow

8 Answers 65 Views
GridView
This is a migrated thread and some comments may be shown as answers.
dttanh
Top achievements
Rank 1
dttanh asked on 16 Nov 2011, 02:56 AM
Hello,

I create a grid that allows to modify data directly in the gridviewrow by invoking the "BeginEdit()". But when I call the CancelEdit() the data isn't revert to the initial value --> do you have any solution for this?

It seems that data on row isn't refreshed--> after cancelEdit() --> I can BeginEdit() again --> data (of editing cell) is refreshed to initial value.

Thanks!

8 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 16 Nov 2011, 08:37 AM
Hi Dttanh,

This would be the expected behavior since RadGridView commits the edit on loosing the focus. What you can try is to set its ActionOnLostFocus property to "None".
 

Greetings,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
dttanh
Top achievements
Rank 1
answered on 16 Nov 2011, 08:57 AM
that doens't help. I have tried with 3 values of ActionOnLostFocus, all is the same.

The datacontext is still at initial value after CancelEdit() but the gridrow isn't refreshed. I call BeginEdit() --> data refresh then (initial value)
0
Maya
Telerik team
answered on 16 Nov 2011, 09:01 AM
Hi,

I am attaching the sample project I used for testing the case. Would you take a look at it and let me know whether it corresponds to your scenario or I am missing something ?  

Best wishes,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
dttanh
Top achievements
Rank 1
answered on 16 Nov 2011, 09:09 AM
sorry, I give more precision, the cancelEdit() works well when I lose focus from grid. 

But in my situation --> I still have focus on the row

I'll prepare an example & upload here
0
Maya
Telerik team
answered on 16 Nov 2011, 09:16 AM
Hello,

Would it be possible to provide a bit more details on your exact scenario ? Can you get the same behavior on the sample I previously attached ? Is there something more that I need to do in order to reproduce the issue 

All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
dttanh
Top achievements
Rank 1
answered on 16 Nov 2011, 09:41 AM
This is my example:

I do as the following:

1. Click on EditButon of grid
2. Modify some data
3. Click on Cancel button

--> data isn't reverted

http://www.mediafire.com/?3aywt92e4p09wgf

Thanks for your help!
0
Accepted
Nick
Telerik team
answered on 16 Nov 2011, 10:13 AM
Hello Dttanh,

From what I see in the project your Data class does not implement INotifyPropertyChanged, therefore it isn't possible to synchronize the Gridview cells on CommitEdit without calling Rebind(). This actually solves the CancelEdit problem as well. I am attaching a modified version of your project. The only change I made is that the Data class is now deriving from ViewModelBase. 

All the best,
Nikolay Vasilev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
dttanh
Top achievements
Rank 1
answered on 16 Nov 2011, 10:37 AM
That helps. Thanks very much
Tags
GridView
Asked by
dttanh
Top achievements
Rank 1
Answers by
Maya
Telerik team
dttanh
Top achievements
Rank 1
Nick
Telerik team
Share this question
or