I was getting following error when trying to bind the GridView using Entity Framework model collection in EF 6.
using (TrainingDatabaseDB db = new TrainingDatabaseDB()) Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery, DbRawSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList(). Solution
var data = db.PersonalDetails;
GridView1.DataSource = data;
To fix this bug, we need to tweak the code like this
using (TrainingDatabaseDB db = new TrainingDatabaseDB())
var data = db.PersonalDetails.Select(p => p);
GridView1.DataSource = data.ToList();
Where we explicitly selected each record and converted into the List and then bounded to the GridView.
Hope this helps someone.