I am new to link and was following How to bind LINQ data to dropdownlist to try and bind my data to a drop down list using LINQ but I am getting the error "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()." I followed the code example so i am not sure what I am doing wrong or how to fix it. Can anyone please adivse as this is day two of using LINQ.
using (var db = new FullContext())
{
ddlItemType.DataSource = from t in db.ItemTypes
select new { t.ID, t.Name };
ddlItemType.DataTextField = "Name";
ddlItemType.DataValueField = "ID";
ddlItemType.DataBind();
}