Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
135
Entity ChangeTracker.Status not getting updated - always unmodified
posted

I have a WCF call that returns an Entity List(Of SystemUser).

Like So,

Dim ilist As IList(Of SystemUser) = e.Result
SystemUserBindingSource.DataSource = ilist
UltraGrid1.DataSource = SystemUserBindingSource

The data shows in the grid with no problems but when I let the user update the data via the grid, then click a save button, I want to push the changes back to the server like so,

 Using serv As New ServiceReference1.Service1Client("BasicHttpBinding_IService1")
                    For Each item As ServiceReference1.SystemUser In SystemUserBindingSource.DataSource
                        'Update all changes to the database
                        If (item.ChangeTracker.State = ServiceReference1.ObjectState.Added Or _
                            item.ChangeTracker.State = ServiceReference1.ObjectState.Deleted Or _
                            item.ChangeTracker.State = ServiceReference1.ObjectState.Modified) Then
                            'Item is dirty so update to database
                            serv.UpdateSystemUser(item)
                        End If
                    Next
                End Using

 

 

 

 

The problem is that the Status never gets set to modified even though the set was modified. Any ideas? 

 

 

  • 469350
    Offline posted

    Is your "save button" a Button? Or is it something like a toolbar button?

    If it's an actual Button, then the grid should be losing focus and thus committing the changes to the underlying data source.

    If it's a toolbar button, then a toolbar will not take focus, so the grid doesn't lose focus, so it doesn't know that the user is done editing. In which case, you need to call grid.UpdateData to force the changes to be committed.