Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为分页列表视图中的项目编号_C#_Asp.net_Listview - Fatal编程技术网

C# 为分页列表视图中的项目编号

C# 为分页列表视图中的项目编号,c#,asp.net,listview,C#,Asp.net,Listview,我很难想出一个好方法来对分页列表视图中的项目进行编号。我在添加分页之前使用的解决方案工作得很好,但现在页面之间的编号不存在了。如果第一页是1-10,下一页也将是1-10,依此类推。显然,它应该是1-10,11-21,等等 是否有一种更简单的方法来为我丢失的ListView项添加编号?执行此操作的最佳方法是什么?您可以显示ListViewItem.Index属性。请注意,它是基于零的。 你能用这样的东西吗 (PageIndex*PageSize)+ItemIndex如何获取当前页面索引?

我很难想出一个好方法来对分页列表视图中的项目进行编号。我在添加分页之前使用的解决方案工作得很好,但现在页面之间的编号不存在了。如果第一页是1-10,下一页也将是1-10,依此类推。显然,它应该是1-10,11-21,等等


是否有一种更简单的方法来为我丢失的ListView项添加编号?执行此操作的最佳方法是什么?

您可以显示ListViewItem.Index属性。请注意,它是基于零的。

你能用这样的东西吗


(PageIndex*PageSize)+ItemIndex

如何获取当前页面索引?