EditableRootListBase with datagridview control

EditableRootListBase with datagridview control

Old forum URL: forums.lhotka.net/forums/t/2077.aspx


andy posted on Thursday, January 04, 2007

I have employees collections derived from EditableRootListBase setting up to do on demand editing with datagridview control using sample template from the follow post

http://forums.lhotka.net/forums/post/8887.aspx

.

The 'isDirty' flag only set to true for the very first row of the datagridview when doing editing.  As a result, the rest of the rows never get updated.  Not quite sure what the problem is.  Any suggestion?

Andy

 

 

 

RockfordLhotka replied on Thursday, January 04, 2007

So when you edit, say, line 3 and change the values in that object somehow IsDirty is set on the first object in the list? Since each object in the list tracks its own state, including IsDirty, it should not be possible for an edit of one object to change the state of another object. Can you elaborate further on what you are doing?

andy replied on Thursday, January 04, 2007

Rocky,

I am only able to edit the very first row.  The rest of the rows in the datagridview can not  be updated because  'isDirty' flag is not being setI found out through tracing the executing process in debug mode in Visual studio.

Andy

RockfordLhotka replied on Thursday, January 04, 2007

I still don't understand. You can't edit the remaining rows because the grid puts those rows into read-only mode? Or your edits to those rows are ignored?
 
In other words, can you get into the row in the grid and edit the data? And if not, why? And if so, what happens exactly? Do the changes in the grid not make it to the object? Or do they make it to the object and then get ignored?
 
Rocky
 

andy replied on Thursday, January 04, 2007

I am able to edit the rows just fine.  It just those rows never get persisted in the database because the DataPortal_Update method in my biz object never get called since the 'isDirty' is not being set properly for the base class to do so.

 

Andy

RockfordLhotka replied on Thursday, January 04, 2007

In that case I'd suggest putting a breakpoint in your property set so you can ensure that the object's property is being set as you expect. IsDirty gets set when PropertyHasChanged() is called. If that code is running, then there's some point in there where the object is being rolled back (CancelEdit probably).
 
Rocky

andy replied on Thursday, January 04, 2007

It's very strange that it's only working for the very first row of the grid.

Anyway, I'll poke around to see I can pin point the problem.

Andy

andy replied on Thursday, January 04, 2007

Just to follow up with the issue. 

I got a System.StackOverflowException when try to force the update via base.Save(true) in my biz object SAVE's method.   Not sure it can trigger an infinite loop or recursion by doing just that.

Andy

Copyright (c) Marimer LLC