numbering a repeater rows

a8le

Well-known member
Joined
Oct 27, 2005
Messages
75
Programming Experience
5-10
hi all,

is there a simple way to number repeater rows? for example my repeater displays....

comments on a blog...

comment one
comment two
comment three
etc...

i want it to be...

1) comment one
2) comment two
3) comment three and so forth

i would appreciate any advice, thanx in advance.

-a8le
 
hi JohnH,

where is exactly did you see that...
HTML:
<%#Container.ItemIndex%>
i can't find it... its not on that page or the other properties pages.

by the way, i got it to work. thnx for the help.

-a8le
 
Actually I didn't find the reference for Container.ItemIndex either, I saw Container.DataItem in that example and just inspected the Container object and it's properties in the intellitype editor.
 
Try this it will work at the same time give the result which fashion you need

<%@ Page Language="VB" AutoEventWireup="True" %>
<html>
<head>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, e As EventArgs)

If Not IsPostBack Then
Dim values As New ArrayList()

values.Add("Apple")
values.Add("Orange")
values.Add("Pear")
values.Add("Banana")
values.Add("Grape")

Repeater1.DataSource = values
Repeater1.DataBind()

End If
End Sub

</script>

</head>
<body>

<h3>Repeater Example</h3>

<form runat=server>

<b>Repeater1:</b>
<p>

<asp:Repeater id=Repeater1 runat="server">

<HeaderTemplate>
<table border=1>
</HeaderTemplate>

<ItemTemplate>
<tr>
<td>
<%# Container.ItemIndex+1 %>
<%# Container.DataItem %>
</td>
</tr>

</ItemTemplate>

<FooterTemplate>
</table>
</FooterTemplate>

</asp:Repeater>

<p>

</form>
</body>
</html>
 
duh, that was the solution given in first reply.
 
Back
Top