I have a devexpress GridControl for which I set it as a data source:
var regs = (from vcap in context.chaps select vcap); gridControl1.DataSource = new BindingList<chaps>(regs.ToList());
But when I use the grid, the rows that I add or delete are not saved, only the changes to the original rows are saved.
If I do this:
gridControl1.DataSource = context.chaps.Local;
I do not receive any lines, and AddNewRow does not even add a new line visually.
If I do this:
gridControl1.DataSource = context.chaps.ToList();
I get strings and can save changes to them; lines look visually, but not in db, and cannot AddNewRow .
If I do this:
gridControl1.DataSource = context.chaps;
I get this exception:
Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery) 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().
but context.chaps.Local also does not have a ToBindingList method.
I donβt think this is a devexpress problem, but I donβt understand how to set the data source correctly. Is there a way to get the equivalent of context.chaps.Local.ToBindingList() ?
source share