Index of the index of the current element when binding to the repeater

I bind List<HtmlImage> to the relay

In fact, it is a nested repeater, and this list is one of the properties that the parent repeater associates with

I want to spit out the index of the current data item in the id <li> property

I added a comment where I want the index to appear below

I have the following:

  <asp:Repeater ID="ImageListRepeater" runat="server" DataSource='<%# DataBinder.Eval(Container.DataItem, "Images") %>'> <HeaderTemplate><ul></HeaderTemplate> <ItemTemplate> <li id='<% **I want the Index Here** %>'><%# RenderImage(Container.DataItem)%></li> </ItemTemplate> <FooterTemplate></ul></FooterTemplate> </asp:Repeater> 

What are the options?

thanks

+4
source share
1 answer

Have you tried <%# Container.ItemIndex %> ?

+6
source

All Articles