【发布时间】:2012-07-23 22:03:31
【问题描述】:
我无法让PagedDataSource 使用EntityCollection 对象的IEnumerated 集合作为数据源。
PagedDataSource 接受集合作为数据源,但我不能使用 CurrentPageIndex 和 IsLastPage 等基本属性。
我的应用程序因错误 Cannot compute Count for a data source that does not implement ICollection. 而中断
我试过了
ICollection<Location> listlocations = Company.Locations;
但没有成功。
我能做什么?
代码sn-p
protected void loadBuildings()
{
PagedDataSource pds = new PagedDataSource();
pds.DataSource = Company.Locations;
pds.AllowPaging = true;
pds.PageSize = Convert.ToInt16(ddlPageSize.SelectedValue);
pds.CurrentPageIndex = CurrentPage;
lnkbtnNext.Enabled = !pds.IsLastPage;
lnkbtnPrevious.Enabled = !pds.IsFirstPage;
buildingsDataList.DataSource = pds;
buildingsDataList.DataBind();
}
【问题讨论】:
标签: c# datasource icollection entitycollection