如何在列表视图页面中提供序列号? [英] How do I give serial numbers in list view pages ?

查看:87
本文介绍了如何在列表视图页面中提供序列号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

The serial numbers should be correct in the consecutive pages.





我尝试过的:



我尝试使用偏移计算直接从数据库提供序列号。我也试过提供'Container.ItemIndex + 1'。有人可以提供更好的解决方案吗?



What I have tried:

I tried providing serial number directly from the database using offset calculations. I also tried providing the 'Container.ItemIndex + 1'. Can someone provide a better solution?

推荐答案

假设你正在使用 ListView控件 [ ^ ],你需要使用 Container.DataItemIndex 而不是 Container.ItemIndex



ListViewItem.DataItemIndex属性(System.Web.UI .WebControls)| Microsoft Docs [ ^ ]



Assuming you're using the ListView control[^], you'll need to use Container.DataItemIndex instead of Container.ItemIndex.

ListViewItem.DataItemIndex Property (System.Web.UI.WebControls) | Microsoft Docs[^]

<ItemTemplate>
    <%#: Container.DataItemIndex + 1 %>
    ...


sql server - 如何将序列号列添加到结果数据中? - 堆栈溢出 [ ^ ]


这篇关于如何在列表视图页面中提供序列号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆