从实体框架到 Listivew 数据源的数据绑定
我的实体返回以下内容:
class StoreClass{
public Entry GetStoreInfo(int id, UserInfo userInfo)
{
using (var context = new StoreEntities())
{
var query = from a in context.Store
.Include("Ratings")
.Include("Versions")
.Include("Versions.Installers")
.Include("Versions.Installers.Screenshots")
.Include("Category")
where a.ID == id && a.IsActive
select a;
return query.FirstOrDefault();
}
}
}
我试图将从上述函数返回的数据绑定到列表视图。
StoreClass objStore = new StoreClass ();
Listview1.DataSource = objStore .GetStoreInfo(1,userInfo);
LstAppletInfo.DataBind();
}
但它会抛出错误“数据源是无效类型。它必须是 IListSource、IEnumerable 或 IDataSource”。
帮我解决这个问题!!!
My entity is returning the following:
class StoreClass{
public Entry GetStoreInfo(int id, UserInfo userInfo)
{
using (var context = new StoreEntities())
{
var query = from a in context.Store
.Include("Ratings")
.Include("Versions")
.Include("Versions.Installers")
.Include("Versions.Installers.Screenshots")
.Include("Category")
where a.ID == id && a.IsActive
select a;
return query.FirstOrDefault();
}
}
}
I am trying to bind the data data returned form the above function to the listview.
StoreClass objStore = new StoreClass ();
Listview1.DataSource = objStore .GetStoreInfo(1,userInfo);
LstAppletInfo.DataBind();
}
But its throwing an error "Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource."
Help me solve this!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)