How to get the next and previous row value in repeater item command?

断了今生、忘了曾经 提交于 2019-12-12 00:34:13

问题


Is there any way to get the next or previous row value of repeater on Item_Command event of repeater?


回答1:


Try something like this... in your Item_Command handler:

Button senderButton = (Button)sender;
RepeaterItem currentRepeaterItem = (RepeaterItem)(senderButton.NamingContainer);
int currentRepeaterItemIndex = currentRepeaterItem.ItemIndex;

RepeaterItem previousRepeaterItem = MyRepeater.Items[currentRepeaterItemIndex-1];
RepeaterItem nextRepeaterItem = MyRepeater.Items[currentRepeaterItemIndex+1];


来源:https://stackoverflow.com/questions/16858684/how-to-get-the-next-and-previous-row-value-in-repeater-item-command

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!