从asp.net中的itemDataBound访问分页数据源

发布于 2024-09-24 05:09:23 字数 91 浏览 0 评论 0原文

我已将中继器绑定到 PagedDataSource,并且想从 ItemDataBound 事件获取 PagedCount。我尝试了一些方法但不起作用。有谁知道该怎么做?

I've bound my repeater to a PagedDataSource and I want to get the PagedCount from the ItemDataBound event. I've tried a few things and it's not working. Does anyone know how to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

美胚控场 2024-10-01 05:09:23

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

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

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

不过,在绑定所有项目后,DataSource 将为 null。

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

It's probably been resolved, but here goes.

You want to use this value when binding the footer element for paging, right?
You can access the datasource on databound.

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

The DataSource will be null, though, after all the items have been bound.

When binding the buttons or links, you can set the page numbers in button.CommandArgument and set button.CommandName = "next", for example.
Then ofcourse add the OnItemCommand stuff.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文