Use:
<%#(((RepeaterItem)Container).ItemIndex+1).ToString() %>
Example implementation 1:
<asp:Repeater ID="rep1" runat="server' DataSourceID="myds"> <ItemTemplate> <%#(((RepeaterItem)Container).ItemIndex+1).ToString() %> <-- other data binding expressions here... --> </ItemTemplate> </asp:Repeater>
Example implementation 2:
<td class="c1"> <b> <%-- 1. CVS 109 South High Street Columbus, OH 43215 Get Directions --%> <%#(((RepeaterItem)Container).ItemIndex+1).ToString() %>. <%# Eval("LocationName") %></b><br /> <%# Eval("Address")%><br /> <%# Eval("City")%>, <%# Eval("State")%> <%# Eval("Zip")%> <br /> <a target="_blank" href='http://maps.google.com/maps?f=q&hl=en&q=from:<%= AddressEntered %>+to:<%# Eval("address") %>, <%# Eval("city") %>,<%# Eval("state") %>,<%# Eval("zip") %>'>Get Directions</a> </td>
Derek,
What if I wanted the bottom row to be #1 and count up from there?
I’ve just spent about half an hour working out how to do this, for use in a Repeater in Kentico CMS.
Your works perfectly,
Thank You,
Mike.