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

Cancel insert

5 Answers 104 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Edo Cof
Top achievements
Rank 1
Edo Cof asked on 20 Mar 2010, 01:22 PM
I think that this problem appear in SL4, but i am not sure.
However.
On button click i call grid.BeginInsert();
Then on some custom logic, i want to cancel insert. I call grid.CancelEdit() since CancelInsert() doesn't exists, but the grid doesn't delete that item that appears on BeginInsert().

Watch the attachment.

5 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 23 Mar 2010, 07:11 PM
Hello Matjaz Cof,

Like in your other post RadGridView.ActionOnLostFocus property is taken into account when you click outside the grid and new row is actually committed before CancelEdit() call. If you want to control commit and cancel from outside buttons just set this property to "None".

Best wishes,
Nedyalko Nikolov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Edo Cof
Top achievements
Rank 1
answered on 04 Apr 2010, 02:04 PM
Maybe i forget, that i set Grid to ReadOnly between Insert and cancel.
I made a sample project.
Just run it, click New item and then Cancel. The item doesn't disappear.
demo
0
Nedyalko Nikolov
Telerik team
answered on 06 Apr 2010, 08:43 PM
Hi Matjaz Cof,

As I understand you want to stop user from editing except maybe for the new added item. In order to achieve this you can use RadGridView.RowEditEnded event. I'm attaching a modified version of your example which demonstrates this approach. Let me know if this does not help.

Sincerely yours,
Nedyalko Nikolov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Edo Cof
Top achievements
Rank 1
answered on 18 Apr 2010, 10:57 AM
Well you don't understand.
I want to be grid ReadOnly all the time, because i edit data in seperate form.

I only change readonly property, so that i can get edit indicator and Add indicator from row.
0
Nedyalko Nikolov
Telerik team
answered on 21 Apr 2010, 04:48 PM
Hi Matjaz Cof,

This means that you do not want to edit data via RadGridView. Then you can modify underlying data source directly to meet your goals. The idea is simple add item into underlying data source (if it is a collection that implements INotifyCollectionChanged interface item will be added into RadGridView automatically), scroll to this item and set its "IsInEditMode" property to true (this will add editing indicator in front of the row). Unfortunately you have to handle Commit and Cancel edit also. I'm attaching a modified version of the sample project that demonstrates this approach. Let me know how this works on your end.

Best wishes,
Nedyalko Nikolov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Edo Cof
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Edo Cof
Top achievements
Rank 1
Share this question
or