SubmitChanges does not update a related datagridview
I have 3 related datagridviews on a Windows Forms page and I have a LINQ method to add/change records in the 3rd datagridview.
It works fine and the calling SubmitChanges works and records are added correctly to the SQL database but they are not shown on the datagridview - I have to exit the application and restart before I can see the new/changed records. I've tried various refresh options but without successs.
I also tried calling what I do in the Form Load i.e.DayBindingSource.DataSource = db.Days immediately after SubmitChanges to reload all of the datagridiews but that has no effect either.
Any guidance would be welcomed!
This looks like it's related to my problem (see: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1968247&SiteID=1).
Table<T> implements IListSource, IListSource.GetList() creates a separate IList for binding, which doesn't track the changes of the table, only writes back it's own changes.
The best solution I've found so far is to manually sync the related BindingList via events and partial methods. You can alternatively try DayBindingSource.DataSource = db.Days.GetNewBindingList()
I can help you, I have no problem in refreshing my DatagridView, I am using VS2008 Beta2, what VS you are using.
Thanks
http://www.ifuturesoft.com
Hi Matt,
Thanks for this but I'm still lost as to why it works OK for table 1 and 2 but not for table 3? I can make changes in either of datagrids 1 or 2 and those changes are reflected in both the physical tables and the associated datagrids.
Also, because the datagrid that does not reflect changes to datagrid 2 is the 3rd in the relationship, I cannot see how to create a LINQ query that will completely synchronise with the other 2 datagrids/tables.
Thanks in advance.