如何在转发器项模板中获取当前查看的itemindex [英] How to get current viewed itemindex in a repeater item template
问题描述
Hello House,请问如何才能获得当前查看的转发器项目模板的itemindex,尝试了一些我从谷歌搜索获得的东西,但它似乎无法正常工作。
i有以下物品:
1 text link1
2 text link2
3 text link3
4文字链接4
其中1,2,3,4是itemindex,我希望能够在单击文本link1时获得1,或者如果文本链接则为2两个点击等。
如有任何进一步的帮助将不胜感激。在此先感谢
Hello House, Please how can i get current viewed itemindex of a repeater item template, have tried a few stuffs i got from google search, but it seems not to work.
i have items like:
1 text link1
2 text link2
3 text link3
4 text link4
where 1, 2, 3, 4 are the itemindex, i want to be able to get 1 if text link1 is clicked, or 2 if text link two is clicked etc.
please any further assistance will be greatly appreciated. Thanks in advance
推荐答案
通过一些MSDN文章或使用intellisense,您应该能够看到它在e.Item.ItemIndex上。
参见 http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.itemdatabound%28v=vs.110%29.aspx [ ^ ]。
然后看 http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeateritem%28v=vs.110%29.aspx [ ^ ]。
Following through some MSDN articles or using intellisense you should be able to see that it is on e.Item.ItemIndex.
See http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.itemdatabound%28v=vs.110%29.aspx[^] for the ItemDataBound event.
Then see http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeateritem%28v=vs.110%29.aspx[^] for the item properties.
这篇关于如何在转发器项模板中获取当前查看的itemindex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!