问题
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