【问题标题】:accessing paged data source from itemDataBound in asp.net从 asp.net 中的 itemDataBound 访问分页数据源
【发布时间】:2010-09-21 17:35:31
【问题描述】:

我已将转发器绑定到 PagedDataSource,并且我想从 ItemDataBound 事件中获取 PagedCount。我已经尝试了几件事,但它不起作用。有人知道怎么做吗?

【问题讨论】:

    标签: asp.net repeater custompaging


    【解决方案1】:

    它可能已经解决了,但这里是。

    您想在绑定页脚元素进行分页时使用此值,对吗? 您可以访问数据绑定上的数据源。

    List<object> dataSource = repeater.DataSource as List<object>;
    

    但是,在绑定所有项之后,DataSource 将为空。

    绑定按钮或链接时,可以在button.CommandArgument中设置页码,例如设置button.CommandName = "next"。 然后当然添加OnItemCommand 的东西。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-07-31
      • 1970-01-01
      • 2020-09-02
      • 1970-01-01
      • 1970-01-01
      • 2010-09-25
      • 2023-01-28
      相关资源
      最近更新 更多