You need to look at the various Repeater Events. One that might work is the ItemCreated event,
Repeater.ItemCreated Event (System.Web.UI.WebControls) | Microsoft Docs[
^] or possibly the ItemDataBound event,
Repeater.ItemDataBound Event (System.Web.UI.WebControls) | Microsoft Docs[
^]
However, if you're trying to compare with the one below it then the one below won't exist when these events fire so you may have to loop through all of the items during one of the page events, possibly LoadComplete or PreRender,
Understanding the order of ASP.NET Page events[
^]
Another option is to compare in SQL and return a flag that can be used in the ItemDataBound event.