DESC Container.ItemIndex

Recently had a need to reverse the count for an Repeater for one of my pages.

My google searches: DESC Container.ItemIndex, reverse repeater count, ItemIndex(), etc.

Much of the code I found either didn’t fit into my code or required behind code rework that I wasn’t willing to do until necessary.

My last search: start with last Container.ItemIndex, landed me here:

Again I had to modify the code a little, but this worked for me…

< %# (-1 * (Container.ItemIndex - DirectCast(DirectCast(Container.Parent, Repeater).DataSource, IList).Count)) %>

I hope someone else can use it!

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit exceeded. Please complete the captcha once again.