I have an UltraGrid on a Windows form. This grid is hierarchical and is bound to a BindingSource which is bound to an EntityCollection (Entity Framework). This hierarchy is made up of people and addresses as follows:
Person 1
-> Address 1
-> Address 2
Person 2
Each set of addresses has a new row template available at the bottom for adding additional addresses. When I first enter the new row to add an address, a new address entity is created with an EntityState of Detached. If I tab to the next row, the EntityState is changed to Added. This is the proper behavior.
The problem is that if I use this new row to add an additional address and then click to another band instead of tabbing to the next row, the EntityState remains as detached and does not get saved to the database. Additionally, if I click back to the original address band, the address I just added disappears.
For example:
I add an address to a person...
Doe John
-> 123 Main Street (... I press tab to move to the next line and add a second address ...)
-> 456 Central Ave (... Instead of tabbing to the next line, I click to the addresses of another person ...).
Doe Jane
-> 789 Washington Ave (... Here.)
... If I then click back to the addresses for John Doe, the 456 Central Ave address disappears because I never tabbed off of that line.
How do I prevent this behavior.
This does seem to fix the issue. Thank you.
There is a minor user interface penalty because the user now needs to double click to move to a sibling row within the same band. It must be a side effect of calling CommitRow.
Hello Jacob,
Ok, after reviewing the sample again I noticed the behavior occurs across child rows of different bands. However I like to mention that patch does not fix this. There was an issue with the way the parent row was is committed. Now when clicking a sibling/add new row in the same band the parent row no longer disappears.
If you click a row higher up or across a band all together then that row is still not committed.
To address this behavior you are going to be required to handle the BeforeRowDeactivate event and call PerformAction on your grid to commit the row.
Private Sub UltraGrid1_BeforeRowDeactivate(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles UltraGrid1.BeforeRowDeactivate With UltraGrid1 .PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.CommitRow) '.Update() //Optional End With End Sub
Private Sub UltraGrid1_BeforeRowDeactivate(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles UltraGrid1.BeforeRowDeactivate
With UltraGrid1
.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.CommitRow)
'.Update() //Optional
End With
End Sub
Let me know if you have any questions regarding this matter.
I tried to upload a video showing the issue and showing that I am using the updated version of 2014.1. However, the upload function is not working for me.
I updated to the latest service release available and I was able to access the child row unlike before. The parent row is now committed and the child row no longer disappears when I enter it.
Please make sure that your application is referencing the updated assemblies. You can view them within Visual Studio through the Solution Explorer > References > right-click choose Properties > Version
After I updated I immediatly updated the project using the version utility. The version utility is accessible by choosing Tools > Update Infragistics Version 14.1 within Visual Studio.
Let me know if you have any questions.
I'm sorry, but this does not fix the problem. I used the same sample I originally uploaded to test and the same problem persists.