How to 'Auto Save' after an edit and scrolling to a new row


Author
Message
Peter Jones
Peter Jones
Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)Advanced StrataFrame User (520 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K

I'm having problems working my way through this issue and I was hoping you could provide a code snippet/advice to show me how I handling this function correctly. I'm using a DevExpress grid and want to auto save any changes as the user moves between rows. To do this I have the following code in the BO:

Private Sub boATT_Navigating(ByVal e As MicroFour.StrataFrame.Business.NavigatingEventArgs) Handles Me.Navigating
   If Me.IsDirty Then
      Me.Save()
   End If
End Sub

This works fine until I add a new record. Then, for some reason, IsDirty is True (when it shouldn't be) and Save executes. The problem is boATT_Navigating keeps getting fired and, because IsDirty is still true, Save executes again and eventually I get a stack overflow on the Save.

I tried (and failed) to find a property that tells me I'm entering 'create a new record' mode. I thought I could add that test to the IsDirty so I don't execute the Save when starting the create new record cycle.

I'm not setting any default values so that isn't the cause if IsDirty being true.

Even though Save is firing no SQL update code is being executed.

Cheers, Peter

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search