有没有办法在转发器的Item_Command事件中获取转发器的下一行或上一行值?
答案 0 :(得分:1)
在Item_Command处理程序中尝试这样的事情:
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];