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

SL4 error on DomainContext.SubmitChanges

6 Answers 197 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, 03:52 PM
This code worked in SL3, but now i am getting error.
My sequence is:
grid.BeginInsert();
grid.IsEnabled = false;  //i only want, that grid show me new row, but i want to edit in custom form.
    //some editing in custom form and then button click.
grid.IsEnabled = true;
grid.CommitEdit();
MyDomainContext.SubmitChanges();

Here i get error:
Entity 'Groups : -1' 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 try not to set IsEnabled to false and everything works. But i don't want to user allowed to edit in grid. I want that only new row is showned. I get this kind ob behaviour with setting grid enabled to false.

Callstack:
   at System.ServiceModel.DomainServices.Client.DomainContext.ValidateChangeset(EntityChangeSet changeSet)
   at System.ServiceModel.DomainServices.Client.DomainContext.SubmitChanges(Action`1 callback, Object userState)
   at System.ServiceModel.DomainServices.Client.DomainContext.SubmitChanges()
   at Urnik.Tables.SifrantPage.buttonPostClick(Object sender, RoutedEventArgs e)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)



6 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 22 Mar 2010, 11:48 AM
Hi Matjaz Cof,

Could you please open a separate support ticket and send us a small dummy sample that reproduces this. We will need something to debug in order to see what is going on. Thanks in advance.

All the best,
Ross
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
Bryan Williams
Top achievements
Rank 2
answered on 23 Mar 2010, 04:44 PM
We are doing something very similar using the RowDetailDataTemplate to edit or add a row.
We do the BeginInsert so that the row will appear and see the same error when we try to do a Commit edit

MenuBarGrid.IsReadOnly =

 

false;

 

MenuBarGrid.CommitEdit();

MenuBarGrid.IsReadOnly =

 

true;

 

MainDataSource.SubmitChanges();

If I replace the CommitEdit() with a CancelEdit() I do not see the error, but I also lose my changes.

It does not appear that there is an 'EndEdit' method in RadGridView....

I'd be interested in the resolution as well....
Thank you

0
Bryan Williams
Top achievements
Rank 2
answered on 23 Mar 2010, 06:57 PM
I was able to get past the 'EndEdit' error by replacing the CommitEdit with the following....I have other issues to resolve so I cannot say sure that this is the final solution, but maybe it can help you...
(C#)

IEditableObject SelectedProject = (IEditableObject)MenuBarGrid.SelectedItem;
SelectedProject.EndEdit();
0
Bryan Williams
Top achievements
Rank 2
answered on 24 Mar 2010, 02:52 PM
Once I got past some validation issues, this did in fact resolve my issue....
0
Edo Cof
Top achievements
Rank 1
answered on 04 Apr 2010, 02:25 PM
Well it's not working for me.
Do you really need test project. That means truble with database, tables,...
The steps to reproduce the problem is just:
gridMainGrid.BeginInsert(); 
gridMainGrid.IsReadOnly = true;             
 
//some stuff 
//button click: 
 
gridMainGrid.IsReadOnly = false
gridMainGrid.CommitEdit(); 
DS.SubmitChanges(); // --> error 
 
If there is no way to solve the problem, please let me know, and i will try to make a sample project.
0
Bryan Williams
Top achievements
Rank 2
answered on 05 Apr 2010, 01:43 PM

Based on the code you show, I only see one difference int he way you are handling this.
I return the grid to read only after the begin insert and then swap the flag back just before ending the edit. Not sure if this will help you at all...

// User presses 'Add' button
BaseBrowseGrid.IsReadOnly = false;

 

BaseBrowseGrid.BeginInsert();
BaseBrowseGrid.IsReadOnly = true;

....Edits occur in form....

//User presses 'Save' button
BaseBrowseGrid.IsReadOnly = false;
 
IEditableObject
SelectedProject = (IEditableObject)BaseBrowseGrid.SelectedItem; 

 

 

SelectedProject.EndEdit();

BaseBrowseGrid.CommitEdit();

BaseBrowseGrid.IsReadOnly = true;

 

BaseDataSource.SubmitChanges();

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Tags
GridView
Asked by
Edo Cof
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Bryan Williams
Top achievements
Rank 2
Edo Cof
Top achievements
Rank 1
Share this question
or