Devexpress GridView Binding RRS feed

  • Question

  • User-43177189 posted


    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
                   select new
                       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


    Monday, September 22, 2014 4:33 AM

All replies

  • User1082734430 posted

    comboBoxProperties.DataSource = DBModel.GetCountries(); should be

    comboBox.Properties.DataSource = DBModel.GetCountries();  May be its a typo !!!

    Monday, September 22, 2014 1:52 PM