views:

188

answers:

1

I am binding a List<HtmlImage> to a repeater

Its actually a nested repeater and the list is one of the properties that the parent repeater is binding to

I want to spit out the index of the current dataitem into the id property of the <li>

I've put 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

+1  A: 

Hi,

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

DavidGouge
thank you...I knew it was something like that. I had tried Databinder, the id of the repeater, Datasource, but intellisense was showing that none of those had an index property
Christo Fur