Skip to main content
Microsoft Silverlight
Home Forums Silverlight Programming WCF RIA Services Entity is currently being edited and has uncommitted changes - EndEdit before changes can be submitted
10 replies. Latest Post by thanhhh on March 4, 2010.
(0)
callmeknud
Member
16 points
84 Posts
05-19-2009 9:58 AM |
Hello, the ItemsSource of my DG is set like this: myDG.ItemsSource = context.Projects; If the User clicks on the Save Button (context.SubmitChanges();) while a cell is still in editing mode the following exception is thrown:Entity 'Projects : 3' is currently being edited and has uncommitted changes. A call to BeginEdit must be followed by a call to EndEdit or CancelEdit before changes can be submitted.I tried myDG.EndEdit(); but the error still occurs ...?
xusun
Participant
1363 points
216 Posts
05-19-2009 2:05 PM |
I don't think there's myDG.EndEdit method. Did you call myDG.CommitEdit(DataGridEditingUnit.Row, true). This will commit the changes to the Entity and Exit the editing mode.
05-20-2009 9:17 AM |
sorry i already called myDG.CommitEdit() not EndEdit but even if i call it with (DataGridEditingUnit.Row, true) i get the same error.
05-20-2009 1:58 PM |
Did you do something special? Actually, even you don't call DG.CommitEdit, it should automatically do it for you while you leave the focus from DataGrid. Could you post some code here?
Jonathan...
All-Star
31167 points
3,020 Posts
05-25-2009 3:22 AM |
Hi Callmeknud,
How's your issue going? Has it been resolved yet? I agree with Xun Sun, if it doesn't work, would you please share a tiny repro here. Thanks.
Best regards,
Jonathan
Firewalk...
2 points
9 Posts
05-25-2009 8:55 PM |
I don't know if this is still an issue or not, but check the return value returned from CommitEdit(). If it's false, make sure that no validation you have in place is preventing the commit to the entity.
05-26-2009 7:21 AM |
Sorry that i didn't reply, but i really had no time.The return value is indeed false, but when i look into the entity when the error occurs, the entity base shows:HasValidationErrors = 0
05-26-2009 8:54 AM |
The DataGrid AutoGenerateColums ist set to false and my Columns look like the following:<data:DataGridTextColumn Header="Sa" Binding="{Binding Sa, Mode=TwoWay,Converter={StaticResource FormatConverter},ConverterCulture=de-DE, ConverterParameter=\{0:0.00\}}"/>I will have a look at the Converter, maybe that causes the Problem.What i don't really understand is, that the error says the Entity is currently being edited but i only tell the DataGrid to commit the changes.Is that right or do i somehow have to tell the Entity to commit the changes?
05-26-2009 9:34 AM |
before context.SubmitChanges() i inserted the following lines and it seems to work, but is this intended?IEditableObject SelectedProject = myDG.SelectedItem as Web.Project;SelectedProject.EndEdit();
05-26-2009 1:30 PM |
Do you mind to send me a sample of your app? I'd like to know where the BeginEdit was called.
thanhhh
1 Posts
03-04-2010 11:33 PM |
Hello,
Before context.SubmitChanges(), you inserted lines of code following:
IEditableObject editableObject = project as IEditableObject; editableObject.EndEdit(); context.SubmitChanges();
Regards
Thanh.