Error Message:
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().
Has something changed in VS2012 - I've used this same strategy before?
Data Layer code to retrieve data:
namespace DataLibrary
{
public class DLgetMasterData
{
POLLINATORSEntities db = new POLLINATORSEntities();
public IEnumerable<string> getSoil()
{
var soilList = from SOTYPE in db.SOTYPEs
orderby SOTYPE.SOTYPE_DESC ascending
select SOTYPE.SOTYPE_DESC;
return soilList;
}
Code behind page in UI:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
try
{
BLgetMasterData obj = new BLgetMasterData();
var soilList = obj.getSoil();
Soil.DataSource = soilList;
Soil.DataBind();
Soil.Items.Insert(0, "Any");
Soil.SelectedValue = "Any";