Item number in datarepeater

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a datarepeater.
<asp:Repeater id="_quiestionsDataRepeater" runat="server"> <ItemTemplate>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<asp:Label id="Label2" runat="server">Label</asp:Label>
</td>
</tr>
</table>
<ItemTemplate>
</asp:Repeater >

It could have multiple rows based on the data. I like to write the sequnce
number of row before the Label2. So if its first row of data I would like 1
to be preceeding the label content and 2 for the second and hence forth....

How can I do that?

Thnx in advance.
 
Add another cell with a label control to the table in the ItemTemplate.
Handle the repeater's PreRender event. In the event handler loop through the
Items collection. For every item find the label and set it's text into the
loop index.
 
Back
Top