Last post Sep 22, 2014 01:52 PM by abhijithmanipal
Sep 22, 2014 04:33 AM|khidir|LINK
I am trying to bind a specific field in devexpress grid view controller to a data source so that it appears as combobox and retrieve its data from that table.
In my model class I have the following method (will the data source for my grid field):
public static IEnumerable GetCountries()
HRNET_TESTEntities variable = new HRNET_TESTEntities();
return from country in variable.lkp_country
CountryID = country.country_id,
CountryName = country.cnt_name,
Then in the grid partial view, I bind the column as:
comboBoxProperties.DataSource = DBModel.GetCountries();
when the asp try to bind the model into the grid the following error occurs:
An exception of type 'System.NotSupportedException' occurred in DevExpress.Web.v13.2.dll but was not handled in user code
Additional information: 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().
I would be thankful if I got some help
Sep 22, 2014 01:52 PM|abhijithmanipal|LINK
comboBoxProperties.DataSource = DBModel.GetCountries(); should be
comboBox.Properties.DataSource = DBModel.GetCountries(); May be its a typo !!!