首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将DataPager用于数据列表?

将DataPager用于数据列表?
EN

Stack Overflow用户
提问于 2010-08-31 08:48:32
回答 1查看 2.7K关注 0票数 0

我们可以为DataList使用DataPager吗?

我已经完成了,但发生了以下异常!

代码语言:javascript
复制
Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 

[InvalidOperationException: Control 'DataList1' does not implement IPageableItemContainer.]
   System.Web.UI.WebControls.DataPager.FindPageableItemContainer() +500609
   System.Web.UI.WebControls.DataPager.OnInit(EventArgs e) +33
   System.Web.UI.Control.InitRecursive(Control namingContainer) +333
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Control.InitRecursive(Control namingContainer) +210
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +378
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-08-31 18:11:26

DataPager需要分页控件来实现IPageableItemContainer接口。该接口是在3.5中引入的,因此旧的控件不会实现该接口。

您的变通办法是创建一个实现此接口的虚拟控件,并根据要用于数据列表的数据源提供必要的分页逻辑。

编辑:顺便说一句,你可以用ListView控件代替DataList。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3605291

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档