Refreshing LINQ datacontext
-
Thursday, December 03, 2009 2:16 PMHi All,I am facing one problem here.I have following methods in DataContext classsp_GetCountries - Returns list of Country classsp_GetCounrty - Returns the object of Country classsp_UpdateCountries - Accept the object of Country as parameterClient first calls method sp_GetCountries method and assign results to grid. Then when user double clicks the particular record on the grid then client calls sp_GetCounrty method and receives the object of country class. After doing some changes client calls sp_UpdateCountries and pass the object of Country class as a parameter. After this I am calling refresh method of DataContext class as followDataContext.Refresh(Data.Linq.RefreshMode.OverwriteCurrentValues, DataContext.Countries)And then calling sp_GetCountries method again and assign results to the grid but grid is still showing the old values. When I actually doubleclick the grid again then i am receiving the Object of Country class with updated values.Since I am new to LINQ to SQL, can somebody help me to resolve this issue?Regards,Prabi
I can be still better.- Moved by Steven Cheng - MSFTMicrosoft Employee Thursday, December 10, 2009 9:28 AM (From:Windows Communication Foundation)
All Replies
-
Saturday, May 15, 2010 5:45 AMI believe you can call the .Refresh method of the DataGrid in order to redraw the grid with the current values. Although, I often just reset the .DataSource property of the BindingSource (or the DataGridView if there is no BindingSource in use).
Brent Spaulding | Access MVP -
Tuesday, October 05, 2010 4:03 AM
Not able to verify at the moment, but as I recall, setting as I have described will force a refresh of the DataGridView.
Brent Spaulding | Access MVP