2010-07-08 109 views
0

我想从DataTable中获取DataItem的索引并将其插入中继器。我试过这个解决方案:Inject Index of Current item when binding to a repeater有没有办法从Repeater中的DataTable获取Item的索引?

但这并不能给我我想要的。该解决方案仅给出了Repeater中项目的位置,但我想要项目在其源DataTable中的位置。

原因是因为我想为我的搜索结果编号,如果我使用上面的解决方案,那么在分页上重置的数字。

谢谢!

回答

2

int resultIndex = (myRepeater.CurrentPageIndex * myRepeater.PageSize) + ItemIndex + 1

+0

辉煌!万分感谢。 – samandmoore 2010-07-09 13:33:17

相关问题